Class: Rna::Filesystem

Inherits:
Outputer show all
Defined in:
lib/rna/outputers.rb

Instance Attribute Summary

Attributes inherited from Outputer

#options

Instance Method Summary collapse

Methods inherited from Outputer

#initialize

Constructor Details

This class inherits a constructor from Rna::Outputer

Instance Method Details

#run(jsons) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/rna/outputers.rb', line 10

def run(jsons)
  output_path = options[:output_path] || "output"
  FileUtils.rm_rf(output_path) if options[:clean]
  FileUtils.mkdir(output_path) unless File.exist?(output_path)
  jsons.each do |role,json|
    puts "  #{role}.json" if options[:verbose]
    File.open("#{output_path}/#{role}.json", 'w') {|f| f.write(json) }
  end
end