Class: Skanetrafiken::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/skanetrafiken/point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, id, type) ⇒ Point

Returns a new instance of Point.



7
8
9
10
11
# File 'lib/skanetrafiken/point.rb', line 7

def initialize(name,id,type)
  @name=name
  @id=id
  @type=type
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/skanetrafiken/point.rb', line 6

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/skanetrafiken/point.rb', line 6

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/skanetrafiken/point.rb', line 6

def type
  @type
end

Instance Method Details

#==(another_point) ⇒ Object



12
13
14
# File 'lib/skanetrafiken/point.rb', line 12

def ==(another_point)
  self.name == another_point.name && self.id == another_point.id && self.type == another_point.type
end

#renderObject



15
16
17
18
# File 'lib/skanetrafiken/point.rb', line 15

def render()
    idx = $point_indexes.index(@type)
   return "#{@name}|#{@id}|#{idx}"
end