Class: Hanami::Entity::Schema Private
- Inherits:
-
Object
- Object
- Hanami::Entity::Schema
- Defined in:
- lib/hanami/entity/schema.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Entity schema is a definition of a set of typed attributes.
Direct Known Subclasses
Defined Under Namespace
Classes: Definition, Schemaless
Instance Method Summary collapse
-
#attribute?(name) ⇒ TrueClass, FalseClass
private
Check if the attribute is known.
-
#call(attributes) ⇒ Object
(also: #[])
private
Process attributes.
-
#initialize(&blk) ⇒ Hanami::Entity::Schema
constructor
private
Build a new instance of Schema with the attributes defined by the given block.
Constructor Details
#initialize(&blk) ⇒ Hanami::Entity::Schema
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build a new instance of Schema with the attributes defined by the given block
207 208 209 210 211 212 213 |
# File 'lib/hanami/entity/schema.rb', line 207 def initialize(&blk) @schema = if block_given? Definition.new(&blk) else Schemaless.new end end |
Instance Method Details
#attribute?(name) ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if the attribute is known
241 242 243 |
# File 'lib/hanami/entity/schema.rb', line 241 def attribute?(name) schema.attribute?(name) end |
#call(attributes) ⇒ Object Also known as: []
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Process attributes
223 224 225 226 227 |
# File 'lib/hanami/entity/schema.rb', line 223 def call(attributes) Utils::Hash.new( schema.call(attributes) ).deep_symbolize! end |