Module: AwsReporting::Store

Defined in:
lib/aws-reporting/store.rb

Defined Under Namespace

Classes: Counter

Constant Summary collapse

FILE_COUNTER =
Counter.new

Class Method Summary collapse

Class Method Details

.save(dir, data) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/aws-reporting/store.rb', line 19

def save(dir, data)
  FileUtils.mkdir_p(dir)

  path = dir + '/' + FILE_COUNTER.get.to_s + '.json'

  json = JSON.dump(data)

  open(path, 'w'){|f|
    f.print JSON.dump(data)
  }

  {:info => data[:info], :path => path}
end