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(type = nil, &blk) ⇒ Hanami::Entity::Schema
constructor
private
Build a new instance of Schema with the attributes defined by the given block.
Constructor Details
#initialize(type = nil, &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
224 225 226 227 228 229 230 |
# File 'lib/hanami/entity/schema.rb', line 224 def initialize(type = nil, &blk) @schema = if block_given? Definition.new(type, &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
258 259 260 |
# File 'lib/hanami/entity/schema.rb', line 258 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
240 241 242 243 244 |
# File 'lib/hanami/entity/schema.rb', line 240 def call(attributes) Utils::Hash.deep_symbolize( schema.call(attributes) ) end |