Class: Dogviz::SigmaGraphHash
- Inherits:
-
Hash
- Object
- Hash
- Dogviz::SigmaGraphHash
- Defined in:
- lib/dogviz/sigma_graph_hash.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ SigmaGraphHash
constructor
A new instance of SigmaGraphHash.
- #output(type_to_filename) ⇒ Object
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
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 |