Class: Formatters::PrintFormatter
- Inherits:
-
Object
- Object
- Formatters::PrintFormatter
- Defined in:
- lib/tramtracker/formatters/print_formatter.rb
Instance Method Summary collapse
-
#initialize(tramtracker) ⇒ PrintFormatter
constructor
A new instance of PrintFormatter.
- #report ⇒ Object
Constructor Details
#initialize(tramtracker) ⇒ PrintFormatter
Returns a new instance of PrintFormatter.
3 4 5 |
# File 'lib/tramtracker/formatters/print_formatter.rb', line 3 def initialize(tramtracker) @tramtracker = tramtracker end |
Instance Method Details
#report ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/tramtracker/formatters/print_formatter.rb', line 7 def report puts Time.now.strftime "[%H:%M:%S] Stop #{@tramtracker.stop_id}" puts "Retrieving tram information..." @tramtracker.get.each do |tram| printf "Route %3s arriving in %2s minutes\n", tram[:route], tram[:minutes] end end |