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.



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

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

Instance Attribute Details

#nametagObject

Attributes access



10
11
12
# File 'lib/map/entity.rb', line 10

def nametag
  @nametag
end

#typeObject

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_sObject



17
18
19
# File 'lib/map/entity.rb', line 17

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