Class: EntityMap::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/entity_map/entity/new.rb,
lib/entity_map/entity/methods.rb,
lib/entity_map/entity/class_methods.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, entity_group) ⇒ Entity

Returns a new instance of Entity.



6
7
8
9
10
11
# File 'lib/entity_map/entity/new.rb', line 6

def initialize(object, entity_group)
  raise "INTERNAL ERROR: Entity.new must have EntityGroup argument" unless EntityGroup === entity_group
  @entity_group = entity_group
  @object = object
  insert_into_entity_hash
end

Instance Attribute Details

#entity_groupObject (readonly)

Returns the value of attribute entity_group.



4
5
6
# File 'lib/entity_map/entity/new.rb', line 4

def entity_group
  @entity_group
end

#objectObject (readonly)

Returns the value of attribute object.



4
5
6
# File 'lib/entity_map/entity/new.rb', line 4

def object
  @object
end

Class Method Details

.object_ref(o) ⇒ Object



5
6
7
# File 'lib/entity_map/entity/class_methods.rb', line 5

def object_ref(o)
  o.object_id
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



4
5
6
# File 'lib/entity_map/entity/methods.rb', line 4

def ==(other)
  Entity.object_ref(self) == Entity.object_ref(other)
end