Class: Lutaml::Model::Schema::Generator::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/model/schema/generator/property.rb

Overview

This class is used to generate a property schema definition. It is used in the context of generating JSON schemas.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attribute, register:) ⇒ Property

Returns a new instance of Property.



10
11
12
13
14
# File 'lib/lutaml/model/schema/generator/property.rb', line 10

def initialize(name, attribute, register:)
  @name = name.to_s.gsub("::", "_")
  @attribute = attribute
  @register = register
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



8
9
10
# File 'lib/lutaml/model/schema/generator/property.rb', line 8

def attribute
  @attribute
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/lutaml/model/schema/generator/property.rb', line 8

def name
  @name
end

#registerObject (readonly)

Returns the value of attribute register.



8
9
10
# File 'lib/lutaml/model/schema/generator/property.rb', line 8

def register
  @register
end

Instance Method Details

#to_schemaObject



16
17
18
# File 'lib/lutaml/model/schema/generator/property.rb', line 16

def to_schema
  { name => generate_attribute_schema(attribute) }
end