Module: SexyJSONSchemas::DSL
- Defined in:
- lib/sexy_json_schemas/dsl.rb
Instance Method Summary collapse
Instance Method Details
#as_json ⇒ Object
14 15 16 17 18 |
# File 'lib/sexy_json_schemas/dsl.rb', line 14 def as_json definition = SchemaDefinition.new(@schema_name, @schema_options) definition.instance_eval(&@definition_block) definition.as_json end |
#schema(name, options = {}, &block) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/sexy_json_schemas/dsl.rb', line 3 def schema(name, = {}, &block) [:root_element] ||= name unless [:root_element] == false @schema_name = name @schema_options = @definition_block = block end |
#schema_name ⇒ Object
10 11 12 |
# File 'lib/sexy_json_schemas/dsl.rb', line 10 def schema_name @schema_name end |