Class: Topo::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/topo/exporter.rb

Class Method Summary collapse

Class Method Details

.to_file(file, topo) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/topo/exporter.rb', line 6

def self.to_file(file, topo)
  
  begin
    File.open(file, 'w') { |f| f.write(JSON.pretty_generate(topo)) }    
   rescue
    STDERR.puts "ERROR: Cannot write to topology export file #{f}"
  end
end