Class: Skanetrafiken::Line
- Inherits:
-
Object
- Object
- Skanetrafiken::Line
- Defined in:
- lib/skanetrafiken/line.rb
Instance Attribute Summary collapse
-
#is_timing_point ⇒ Object
readonly
Returns the value of attribute is_timing_point.
-
#journey_date_time ⇒ Object
readonly
Returns the value of attribute journey_date_time.
-
#line_type_id ⇒ Object
readonly
Returns the value of attribute line_type_id.
-
#line_type_name ⇒ Object
readonly
Returns the value of attribute line_type_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#no ⇒ Object
readonly
Returns the value of attribute no.
-
#stop_point ⇒ Object
readonly
Returns the value of attribute stop_point.
-
#towards ⇒ Object
readonly
Returns the value of attribute towards.
Instance Method Summary collapse
-
#==(another) ⇒ Object
puts @name puts dic.map{ |k,v| “#k: #v” }.join(‘; ’).
-
#initialize(dic) ⇒ Line
constructor
A new instance of Line.
- #to_s ⇒ Object
Constructor Details
#initialize(dic) ⇒ Line
Returns a new instance of Line.
10 11 12 13 14 15 16 17 |
# File 'lib/skanetrafiken/line.rb', line 10 def initialize dic $properties_line.each{ |key,value| val = dic[key] instance_variable_set("@#{key.to_s}", val) } #puts @name #puts dic.map{ |k,v| "#{k}: #{v}" }.join('; ') end |
Instance Attribute Details
#is_timing_point ⇒ Object (readonly)
Returns the value of attribute is_timing_point.
7 8 9 |
# File 'lib/skanetrafiken/line.rb', line 7 def is_timing_point @is_timing_point end |
#journey_date_time ⇒ Object (readonly)
Returns the value of attribute journey_date_time.
7 8 9 |
# File 'lib/skanetrafiken/line.rb', line 7 def journey_date_time @journey_date_time end |
#line_type_id ⇒ Object (readonly)
Returns the value of attribute line_type_id.
7 8 9 |
# File 'lib/skanetrafiken/line.rb', line 7 def line_type_id @line_type_id end |
#line_type_name ⇒ Object (readonly)
Returns the value of attribute line_type_name.
7 8 9 |
# File 'lib/skanetrafiken/line.rb', line 7 def line_type_name @line_type_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/skanetrafiken/line.rb', line 7 def name @name end |
#no ⇒ Object (readonly)
Returns the value of attribute no.
7 8 9 |
# File 'lib/skanetrafiken/line.rb', line 7 def no @no end |
#stop_point ⇒ Object (readonly)
Returns the value of attribute stop_point.
7 8 9 |
# File 'lib/skanetrafiken/line.rb', line 7 def stop_point @stop_point end |
#towards ⇒ Object (readonly)
Returns the value of attribute towards.
7 8 9 |
# File 'lib/skanetrafiken/line.rb', line 7 def towards @towards end |
Instance Method Details
#==(another) ⇒ Object
puts @name puts dic.map{ |k,v| “#k: #v” }.join(‘; ’)
18 19 20 21 22 23 |
# File 'lib/skanetrafiken/line.rb', line 18 def ==(another) return $properties_line.map{ |key,value| k = "@#{key.to_s}" instance_variable_get(k) == another.instance_variable_get(k) }.inject(true){ |result, element| result and element} end |
#to_s ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/skanetrafiken/line.rb', line 24 def to_s a = [] $properties_line.each{ |key,value| val = instance_variable_get("@#{key.to_s}") a.push(":#{key.to_s}=> '#{val}'") } return a.join(", ") end |