Class: Unloq::Entity
- Inherits:
-
Object
- Object
- Unloq::Entity
- Defined in:
- lib/unloq/entity.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(id: nil, type: nil, meta: {}) ⇒ Entity
constructor
Initialize an instance of an unloq entity.
Constructor Details
#initialize(id: nil, type: nil, meta: {}) ⇒ Entity
Initialize an instance of an unloq entity. This has subclasses for Author and Recipient for ease of understanding.
9 10 11 12 13 14 15 16 17 |
# File 'lib/unloq/entity.rb', line 9 def initialize id: nil, type: nil, meta: {} unless id && type raise ArgumentError.new("You must include both an id and a type, e.g. #{self.class.to_s}.new(id: 1, type: 'User')") end @id = id @type = type @meta = end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/unloq/entity.rb', line 3 def id @id end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
3 4 5 |
# File 'lib/unloq/entity.rb', line 3 def @meta end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/unloq/entity.rb', line 3 def type @type end |