Method: Render::Schema#initialize
- Defined in:
- lib/render/schema.rb
#initialize(definition_or_title) ⇒ Schema
Returns a new instance of Schema.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/render/schema.rb', line 22 def initialize(definition_or_title) Render.logger.debug("Loading #{definition_or_title}") process_definition!(definition_or_title) interpolate_refs!(definition) self.title = definition.fetch(:title, DEFAULT_TITLE) self.id = Definition.parse_id(definition) self.type = Type.parse(definition[:type]) || Object if array_schema? self.array_attribute = ArrayAttribute.new(definition) else self.hash_attributes = definition.fetch(:properties).collect do |name, attribute_definition| HashAttribute.new({ name => attribute_definition }) end require_attributes! end end |