Class: SchemaSerializer::Definition
- Inherits:
-
Object
- Object
- SchemaSerializer::Definition
- Defined in:
- lib/schema_serializer/definition.rb
Instance Attribute Summary collapse
-
#schemas ⇒ Object
readonly
Returns the value of attribute schemas.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Definition
constructor
A new instance of Definition.
- #schema(name) ⇒ Object
Constructor Details
#initialize(hash) ⇒ Definition
Returns a new instance of Definition.
5 6 7 8 9 |
# File 'lib/schema_serializer/definition.rb', line 5 def initialize(hash) @schemas = hash.each_with_object({}) { |(name, schema), obj| obj[name.to_s] = Schema.new(name, schema) } end |
Instance Attribute Details
#schemas ⇒ Object (readonly)
Returns the value of attribute schemas.
3 4 5 |
# File 'lib/schema_serializer/definition.rb', line 3 def schemas @schemas end |
Instance Method Details
#schema(name) ⇒ Object
11 12 13 |
# File 'lib/schema_serializer/definition.rb', line 11 def schema(name) schemas[name] || (raise SchemaNotFound, name) end |