Class: BSV::Registry::CertificateFieldDescriptor
- Inherits:
-
Object
- Object
- BSV::Registry::CertificateFieldDescriptor
- Defined in:
- lib/bsv/registry/types.rb
Overview
Describes the structure and metadata for a single certificate field.
Used within CertificateDefinitionData to document the shape of each field in a certificate schema.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
Description of the field’s purpose.
-
#field_icon ⇒ String
readonly
Icon identifier for the field.
-
#friendly_name ⇒ String
readonly
Human-readable field name.
-
#type ⇒ String
readonly
Field type: ‘text’, ‘imageURL’, or ‘other’.
Instance Method Summary collapse
-
#initialize(friendly_name:, description:, type:, field_icon:) ⇒ CertificateFieldDescriptor
constructor
A new instance of CertificateFieldDescriptor.
-
#to_h ⇒ Hash
Serialise to a plain Hash for JSON encoding.
Constructor Details
#initialize(friendly_name:, description:, type:, field_icon:) ⇒ CertificateFieldDescriptor
Returns a new instance of CertificateFieldDescriptor.
35 36 37 38 39 40 |
# File 'lib/bsv/registry/types.rb', line 35 def initialize(friendly_name:, description:, type:, field_icon:) @friendly_name = friendly_name @description = description @type = type @field_icon = field_icon end |
Instance Attribute Details
#description ⇒ String (readonly)
Returns description of the field’s purpose.
23 24 25 |
# File 'lib/bsv/registry/types.rb', line 23 def description @description end |
#field_icon ⇒ String (readonly)
Returns icon identifier for the field.
29 30 31 |
# File 'lib/bsv/registry/types.rb', line 29 def field_icon @field_icon end |
#friendly_name ⇒ String (readonly)
Returns human-readable field name.
20 21 22 |
# File 'lib/bsv/registry/types.rb', line 20 def friendly_name @friendly_name end |
#type ⇒ String (readonly)
Returns field type: ‘text’, ‘imageURL’, or ‘other’.
26 27 28 |
# File 'lib/bsv/registry/types.rb', line 26 def type @type end |
Instance Method Details
#to_h ⇒ Hash
Serialise to a plain Hash for JSON encoding.
45 46 47 48 49 50 51 52 |
# File 'lib/bsv/registry/types.rb', line 45 def to_h { 'friendlyName' => @friendly_name, 'description' => @description, 'type' => @type, 'fieldIcon' => @field_icon } end |