Class: MapEntity::Entity
- Inherits:
-
Object
- Object
- MapEntity::Entity
- Defined in:
- lib/map/entity.rb
Instance Attribute Summary collapse
-
#nametag ⇒ Object
Attributes access.
-
#type ⇒ Object
Attributes access.
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
Redefinition of equal operator.
-
#initialize(type = "", nametag = "") ⇒ Entity
constructor
A new instance of Entity.
- #to_s ⇒ Object
Constructor Details
#initialize(type = "", nametag = "") ⇒ Entity
Returns a new instance of Entity.
5 6 7 |
# File 'lib/map/entity.rb', line 5 def initialize(type = "", = "") @type, = type, end |
Instance Attribute Details
#nametag ⇒ Object
Attributes access
10 11 12 |
# File 'lib/map/entity.rb', line 10 def end |
#type ⇒ Object
Attributes access
10 11 12 |
# File 'lib/map/entity.rb', line 10 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
Redefinition of equal operator
13 14 15 |
# File 'lib/map/entity.rb', line 13 def ==(other) (self.class ==other.class) && (self.state == other.state) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/map/entity.rb', line 17 def to_s() "Type: #{@type}\nName: #{@nametag}" end |