Class: Bort::Schedule::SpecialSchedule
- Inherits:
-
Object
- Object
- Bort::Schedule::SpecialSchedule
- Defined in:
- lib/bort/schedule.rb
Instance Attribute Summary collapse
-
#day_of_week ⇒ Object
Returns the value of attribute day_of_week.
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#link ⇒ Object
Returns the value of attribute link.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#routes_affected ⇒ Object
Returns the value of attribute routes_affected.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#text ⇒ Object
Returns the value of attribute text.
Class Method Summary collapse
Instance Attribute Details
#day_of_week ⇒ Object
Returns the value of attribute day_of_week.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def day_of_week @day_of_week end |
#destination ⇒ Object
Returns the value of attribute destination.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def destination @destination end |
#end_date ⇒ Object
Returns the value of attribute end_date.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def end_date @end_date end |
#end_time ⇒ Object
Returns the value of attribute end_time.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def end_time @end_time end |
#link ⇒ Object
Returns the value of attribute link.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def link @link end |
#origin ⇒ Object
Returns the value of attribute origin.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def origin @origin end |
#routes_affected ⇒ Object
Returns the value of attribute routes_affected.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def routes_affected @routes_affected end |
#start_date ⇒ Object
Returns the value of attribute start_date.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def start_date @start_date end |
#start_time ⇒ Object
Returns the value of attribute start_time.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def start_time @start_time end |
#text ⇒ Object
Returns the value of attribute text.
270 271 272 |
# File 'lib/bort/schedule.rb', line 270 def text @text end |
Class Method Details
.parse(doc) ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/bort/schedule.rb', line 273 def self.parse(doc) schedule = SpecialSchedule.new schedule.start_date = Date.parse((doc/:start_date).inner_text) schedule.end_date = Date.parse((doc/:end_date).inner_text) schedule.start_time = Time.parse("#{schedule.start_date.to_s} #{(doc/:start_time).inner_text}") schedule.end_time = Time.parse("#{schedule.end_date.to_s} #{(doc/:end_time).inner_text}") schedule.text = (doc/:text).inner_text schedule.link = (doc/:link).inner_text schedule.origin = (doc/:orig).inner_text schedule.destination = (doc/:dest).inner_text schedule.day_of_week = (doc/:day_of_week).inner_text.split(',').map(&:to_i) schedule.routes_affected = (doc/:routes_affected).inner_text.split(',') schedule end |