Class: Taeval::Reporter
- Inherits:
-
Object
- Object
- Taeval::Reporter
- Includes:
- FileHelper
- Defined in:
- lib/taeval/reporter.rb
Instance Method Summary collapse
- #add(data) ⇒ Object
-
#initialize(conf_h) ⇒ Reporter
constructor
A new instance of Reporter.
- #save ⇒ Object
Methods included from FileHelper
#create, #exist?, #flatten_include!, #open, #path_of
Constructor Details
#initialize(conf_h) ⇒ Reporter
Returns a new instance of Reporter.
9 10 11 12 |
# File 'lib/taeval/reporter.rb', line 9 def initialize(conf_h) @path = path_of(conf_h.dig('report', 'path')) @records = {} end |
Instance Method Details
#add(data) ⇒ Object
14 15 16 17 18 |
# File 'lib/taeval/reporter.rb', line 14 def add(data) @records[data[:repo]] = {} if !@records.has_key?(data[:repo]) @records[data[:repo]][data[:runner]] = [] if !@records[data[:repo]].has_key?(data[:runner]) @records[data[:repo]][data[:runner]] << data[:msg] end |
#save ⇒ Object
20 21 22 23 24 25 |
# File 'lib/taeval/reporter.rb', line 20 def save p "Reporter#save..." File.open(@path,'w') do |f| f.write(@records.to_json) end end |