Class: Restspec::Schema::SingleSchemaDSL
- Inherits:
-
Object
- Object
- Restspec::Schema::SingleSchemaDSL
- Defined in:
- lib/restspec/schema/dsl.rb
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #attribute(name, type, options = {}) ⇒ Object
-
#initialize(name) ⇒ SingleSchemaDSL
constructor
A new instance of SingleSchemaDSL.
Constructor Details
#initialize(name) ⇒ SingleSchemaDSL
Returns a new instance of SingleSchemaDSL.
16 17 18 |
# File 'lib/restspec/schema/dsl.rb', line 16 def initialize(name) self.schema = Schema.new(name) end |
Instance Attribute Details
#schema ⇒ Object
Returns the value of attribute schema.
14 15 16 |
# File 'lib/restspec/schema/dsl.rb', line 14 def schema @schema end |
Instance Method Details
#attribute(name, type, options = {}) ⇒ Object
20 21 22 23 |
# File 'lib/restspec/schema/dsl.rb', line 20 def attribute(name, type, = {}) new_attribute = Attribute.new(name, type, ) schema.attributes[name.to_s] = new_attribute end |