Class: OAPI::Schema

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSchema

Returns a new instance of Schema.



6
7
8
# File 'lib/oapi/schema.rb', line 6

def initialize
  @schema = yield if block_given?
end

Instance Attribute Details

#schemaObject (readonly)

Returns the value of attribute schema.



4
5
6
# File 'lib/oapi/schema.rb', line 4

def schema
  @schema
end

Class Method Details

.parse(json) ⇒ Object



11
12
13
14
15
16
# File 'lib/oapi/schema.rb', line 11

def parse(json)
  ref = json[:$ref]
  return OAPI::Ref.new(ref) if ref

  new { json }
end