Module: Fried::Schema::DataEntity
- Defined in:
- lib/fried/schema/data_entity.rb
Overview
Includes Struct but also provide a build method which initialize the object with a Hash, setting attributes based on keys
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#to_h ⇒ Hash{Symbol => Object}
A hash containing the values of all attribute name => value.
Class Method Details
.included(klass) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/fried/schema/data_entity.rb', line 27 def self.included(klass) klass.instance_eval do include ::Fried::Schema::Struct extend ClassMethods end end |
Instance Method Details
#to_h ⇒ Hash{Symbol => Object}
Returns a hash containing the values of all attribute name => value.
22 23 24 25 |
# File 'lib/fried/schema/data_entity.rb', line 22 def to_h schema = GetDefinition.(self.class) AttributesToHash.(schema, self) end |