Class: DVB::Stop
- Inherits:
-
Object
- Object
- DVB::Stop
- Defined in:
- lib/dvb/find.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#lat ⇒ Object
readonly
Returns the value of attribute lat.
-
#lng ⇒ Object
readonly
Returns the value of attribute lng.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#search_str ⇒ Object
readonly
Returns the value of attribute search_str.
-
#tarif_zones ⇒ Object
readonly
Returns the value of attribute tarif_zones.
Class Method Summary collapse
Instance Method Summary collapse
- #coords ⇒ Object
-
#initialize(id, lat, lng, name, priority, region, search_str, tarif_zones) ⇒ Stop
constructor
A new instance of Stop.
- #to_s ⇒ Object
Constructor Details
#initialize(id, lat, lng, name, priority, region, search_str, tarif_zones) ⇒ Stop
Returns a new instance of Stop.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dvb/find.rb', line 30 def initialize(id, lat, lng, name, priority, region, search_str, tarif_zones) @id = id @lat = lat @lng = lng @name = name @priority = priority @region = region @search_str = search_str @tarif_zones = tarif_zones end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
28 29 30 |
# File 'lib/dvb/find.rb', line 28 def id @id end |
#lat ⇒ Object (readonly)
Returns the value of attribute lat.
28 29 30 |
# File 'lib/dvb/find.rb', line 28 def lat @lat end |
#lng ⇒ Object (readonly)
Returns the value of attribute lng.
28 29 30 |
# File 'lib/dvb/find.rb', line 28 def lng @lng end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/dvb/find.rb', line 28 def name @name end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
28 29 30 |
# File 'lib/dvb/find.rb', line 28 def priority @priority end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
28 29 30 |
# File 'lib/dvb/find.rb', line 28 def region @region end |
#search_str ⇒ Object (readonly)
Returns the value of attribute search_str.
28 29 30 |
# File 'lib/dvb/find.rb', line 28 def search_str @search_str end |
#tarif_zones ⇒ Object (readonly)
Returns the value of attribute tarif_zones.
28 29 30 |
# File 'lib/dvb/find.rb', line 28 def tarif_zones @tarif_zones end |
Class Method Details
.with_str_hash(h) ⇒ Object
41 42 43 44 45 |
# File 'lib/dvb/find.rb', line 41 def self.with_str_hash(h) lat = h['latitude'] == '999.999999' ? nil : h['latitude'].to_f lng = h['longitude'] == '999.999999' ? nil : h['longitude'].to_f Stop.new(h['id'], lat, lng, h['name'], h['priority'].to_i, h['region'], h['searchstring'], h['tarif_zones']) end |
Instance Method Details
#coords ⇒ Object
47 48 49 50 51 52 |
# File 'lib/dvb/find.rb', line 47 def coords { latitude: @lat, longitute: @lng } end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/dvb/find.rb', line 54 def to_s "#{@name}, #{@region}" end |