Class: Hexx::Entities::Base
Overview
Class Base provides a common interface for entities, that have identity
Class Attribute Summary collapse
-
.uuids ⇒ Array<String>
The list of UUIDs that identify the entity.
Class Method Summary collapse
-
.==(other) ⇒ Boolean
Checks the equality of the entity to another object.
- .initialize(uuids: nil, **attributes) ⇒ Object
-
.new(attributes) ⇒ Hexx::Entities::Base
Creates the entity and initializes its attributes.
Methods inherited from Part
Class Attribute Details
.uuids ⇒ Array<String>
Returns The list of UUIDs that identify the entity.
42 |
# File 'lib/hexx-entities/base.rb', line 42 attribute_reader :uuids |
Class Method Details
.==(other) ⇒ Boolean
Checks the equality of the entity to another object
The entity is equal to any other entity that has at least one of its own uuids.
53 54 55 56 |
# File 'lib/hexx-entities/base.rb', line 53 def ==(other) return false unless other.is_a? Base (other.uuids & uuids).any? end |
.initialize(uuids: nil, **attributes) ⇒ Object
34 35 36 37 |
# File 'lib/hexx-entities/base.rb', line 34 def initialize(uuids: nil, **attributes) @uuids = UUIDs.build Array(uuids) super attributes end |
.new(attributes) ⇒ Hexx::Entities::Base
Creates the entity and initializes its attributes
|
|
# File 'lib/hexx-entities/base.rb', line 25
|