Class: SexyJSONSchemas::SchemaDefinition
- Inherits:
-
Object
- Object
- SexyJSONSchemas::SchemaDefinition
- Extended by:
- Forwardable
- Defined in:
- lib/sexy_json_schemas/schema_definition.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(name, options) ⇒ SchemaDefinition
constructor
A new instance of SchemaDefinition.
Constructor Details
#initialize(name, options) ⇒ SchemaDefinition
Returns a new instance of SchemaDefinition.
10 11 12 13 14 |
# File 'lib/sexy_json_schemas/schema_definition.rb', line 10 def initialize(name, ) @name = name @root_element = .fetch(:root_element, name) @core_object = Properties::Object.new(name, ) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/sexy_json_schemas/schema_definition.rb', line 5 def name @name end |
Instance Method Details
#as_json ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sexy_json_schemas/schema_definition.rb', line 16 def as_json json = @core_object.as_json if root_element? json = wrap_in_root(json) end json['name'] = name json end |