Class: JsonModel::TypeSpec::Object
- Inherits:
-
JsonModel::TypeSpec
- Object
- JsonModel::TypeSpec
- JsonModel::TypeSpec::Object
- Defined in:
- lib/json_model/type_spec/object.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #as_schema(**options) ⇒ Hash
- #cast(json) ⇒ ::Object?
-
#initialize(type) ⇒ Object
constructor
A new instance of Object.
- #referenced_schemas ⇒ Array<TypeSpec>
Methods inherited from JsonModel::TypeSpec
#register_validations, resolve
Constructor Details
#initialize(type) ⇒ Object
Returns a new instance of Object.
9 10 11 12 |
# File 'lib/json_model/type_spec/object.rb', line 9 def initialize(type) super() @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/json_model/type_spec/object.rb', line 6 def type @type end |
Instance Method Details
#as_schema(**options) ⇒ Hash
16 17 18 |
# File 'lib/json_model/type_spec/object.rb', line 16 def as_schema(**) type.as_schema(**) end |
#cast(json) ⇒ ::Object?
27 28 29 |
# File 'lib/json_model/type_spec/object.rb', line 27 def cast(json) type.from_json(**json) end |