Class: Markdo::ForecastCommand
- Inherits:
-
WeekCommand
- Object
- Command
- WeekCommand
- Markdo::ForecastCommand
- Defined in:
- lib/markdo/forecast_command.rb
Overview
TODO: More testing of this logic. As of 2016-01-23, I was building this project as a proof of concept.
Instance Attribute Summary
Attributes inherited from WeekCommand
Instance Method Summary collapse
-
#initialize ⇒ ForecastCommand
constructor
A new instance of ForecastCommand.
- #run ⇒ Object
Constructor Details
#initialize ⇒ ForecastCommand
Returns a new instance of ForecastCommand.
10 11 12 13 |
# File 'lib/markdo/forecast_command.rb', line 10 def initialize(*) @date = Date.today super end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/markdo/forecast_command.rb', line 15 def run # This is pretty ugly, but works. Just testing out how useful the concept is. dates = dates_over_the_next_week dates.shift dates.shift dates.each do |query| stringio = StringIO.new query_command = QueryCommand.new(stringio, @stderr, @env) query_command.run(query) abbreviation = weekday_abbreviation(query) count = stringio.string.split("\n").length @stdout.puts("#{abbreviation}: #{count}") end stringio = StringIO.new next_week_command = WeekCommand.new(stringio, @stderr, @env) next_week_command.date = @date + 7 next_week_command.run next_week_count = stringio.string.split("\n").length @stdout.puts("Next: #{next_week_count}") end |