Class: Dogviz::SigmaGraphHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/dogviz/sigma_graph_hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ SigmaGraphHash

Returns a new instance of SigmaGraphHash.



5
6
7
8
9
# File 'lib/dogviz/sigma_graph_hash.rb', line 5

def initialize(hash)
  hash.each { |k, v|
    self[k] = v
  }
end

Instance Method Details

#output(type_to_filename) ⇒ Object

Raises:

  • (StandardError)


11
12
13
14
15
# File 'lib/dogviz/sigma_graph_hash.rb', line 11

def output(type_to_filename)
  raise StandardError.new('must provide hash (json: somejsonfilename.json)') unless type_to_filename.is_a?(Hash)
  filename = get_json_filename(type_to_filename)
  File.write filename, to_json
end