Class: Baldrick::Listeners::InjourListener

Inherits:
Object
  • Object
show all
Defined in:
lib/baldrick/listeners/injour_listener.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ InjourListener

Returns a new instance of InjourListener.



4
5
6
# File 'lib/baldrick/listeners/injour_listener.rb', line 4

def initialize options = {}
  @last_orders = {}
end

Instance Method Details

#ordersObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/baldrick/listeners/injour_listener.rb', line 8

def orders
  order_pattern = /=== (.*?) on (.*?) ===\n\* \[(.*?)\] (.*?)\n/m
  all_orders = `injour ls`.scan(order_pattern).collect do |match|
    {
      :who => match[0],
      :where => match[1],
      :when => Time.parse(match[2]),
      :what => match[3]
    }
  end

  select_new_orders_from all_orders
end