Class: MapEntity::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/map/entity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = "", nametag = "") ⇒ Entity

Returns a new instance of Entity.



7
8
9
# File 'lib/map/entity.rb', line 7

def initialize(type = "", nametag = "")
  @type, @nametag = type, nametag
end

Instance Attribute Details

#nametagObject

Attributes access



12
13
14
# File 'lib/map/entity.rb', line 12

def nametag
  @nametag
end

#typeObject

Attributes access



12
13
14
# File 'lib/map/entity.rb', line 12

def type
  @type
end

Instance Method Details

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

Redefinition of equal operator



15
16
17
# File 'lib/map/entity.rb', line 15

def ==(other)
  (self.class ==other.class) && (self.state == other.state)
end

#to_sObject



19
20
21
# File 'lib/map/entity.rb', line 19

def to_s()
  "Type: #{@type}\nName: #{@nametag}"
end