Class: Restspec::Schema::SingleSchemaDSL

Inherits:
Object
  • Object
show all
Defined in:
lib/restspec/schema/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#schemaObject

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, options = {})
  new_attribute = Attribute.new(name, type, options)
  schema.attributes[name.to_s] = new_attribute
end