Class: Hexx::Entities::Part
- Inherits:
-
Object
- Object
- Hexx::Entities::Part
- Includes:
- Attestor::Validations, Comparable, Eigindir
- Defined in:
- lib/hexx-entities/part.rb
Overview
Class Part provides a common interface for parts of aggregate entities
Direct Known Subclasses
Class Method Summary collapse
- .initialize(**attributes) ⇒ Object
-
.new(attributes) ⇒ Hexx::Entities::Part
Creates the immutable object.
-
.serialize ⇒ Hash
Recursively serializes the part to the hash.
Class Method Details
.initialize(**attributes) ⇒ Object
37 38 39 40 |
# File 'lib/hexx-entities/part.rb', line 37 def initialize(**attributes) self.attributes = attributes freeze end |
.new(attributes) ⇒ Hexx::Entities::Part
Creates the immutable object
|
|
# File 'lib/hexx-entities/part.rb', line 28
|
.serialize ⇒ Hash
Recursively serializes the part to the hash
Returns the hash of attributes, where every attribute that responds to ‘serialize` is serialized in its turn.
48 49 50 |
# File 'lib/hexx-entities/part.rb', line 48 def serialize attributes.map { |key, value| [key, serialize__(value)] }.to_h end |