Class: AprilONeil::XCTool

Inherits:
Object
  • Object
show all
Defined in:
lib/april_oneil/xctool.rb

Instance Method Summary collapse

Constructor Details

#initialize(input, formatter) ⇒ XCTool

Returns a new instance of XCTool.



5
6
7
8
9
# File 'lib/april_oneil/xctool.rb', line 5

def initialize(input, formatter)
  @input     = input
  @formatter = formatter
  @events = {}
end

Instance Method Details

#startObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/april_oneil/xctool.rb', line 11

def start
  @formatter.before_start

  @input.each_line do |line|
    json  = JSON.parse(line)
    event_name   = json["event"]
    event_method = event_name.gsub("-", "_")

    @formatter.send(event_method, json)
  end

  @formatter.after_end
end