Class: Restspec::Schema::DSL
- Inherits:
-
Object
- Object
- Restspec::Schema::DSL
- Defined in:
- lib/restspec/schema/dsl.rb
Instance Attribute Summary collapse
-
#mixins ⇒ Object
Returns the value of attribute mixins.
-
#schemas ⇒ Object
readonly
Returns the value of attribute schemas.
Instance Method Summary collapse
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #mixin(name, &definition) ⇒ Object
- #schema(name, &definition) ⇒ Object
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
7 8 9 |
# File 'lib/restspec/schema/dsl.rb', line 7 def initialize self.mixins = {} end |
Instance Attribute Details
#mixins ⇒ Object
Returns the value of attribute mixins.
5 6 7 |
# File 'lib/restspec/schema/dsl.rb', line 5 def mixins @mixins end |
#schemas ⇒ Object (readonly)
Returns the value of attribute schemas.
4 5 6 |
# File 'lib/restspec/schema/dsl.rb', line 4 def schemas @schemas end |
Instance Method Details
#mixin(name, &definition) ⇒ Object
17 18 19 |
# File 'lib/restspec/schema/dsl.rb', line 17 def mixin(name, &definition) mixins[name] = definition end |
#schema(name, &definition) ⇒ Object
11 12 13 14 15 |
# File 'lib/restspec/schema/dsl.rb', line 11 def schema(name, &definition) dsl = SingleSchemaDSL.new(name, mixins) dsl.instance_eval(&definition) Restspec::SchemaStore.store(dsl.schema) end |