Class: OrgMode::Presenters::Agenda::Console

Inherits:
Object
  • Object
show all
Defined in:
lib/org_mode/presenters/console.rb

Instance Method Summary collapse

Constructor Details

#initialize(reporter) ⇒ Console

Returns a new instance of Console.



9
10
11
# File 'lib/org_mode/presenters/console.rb', line 9

def initialize reporter
  @agenda_reporter = reporter
end

Instance Method Details

#open_items_per_day_colorizedObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/org_mode/presenters/console.rb', line 13

def open_items_per_day_colorized
  capture_stdout do
    now = DateTime.now
    puts "Agenda: open items grouped by day [#{now.strftime('%Y-%m-%d %H:%M')}]".yellow.underline
    puts
    ongbd = @agenda_reporter.open_nodes_grouped_by_day
    ongbd.each do |e|
      puts "#{e.date}".blue.underline
      e.nodes.each do |n|
        color = :green
        color = :red if n.date_start_time && n.node.date_start_time < now
        color = :red if n.date && n.node.date < now
          
        puts "  " + node_line(n).send(color)
      end
      puts
    end
  end
end