Sha256: fe2b30e6e6baf880b833556b944bf66da91ddec4d5cf0343d63f8e86d474c91c
Contents?: true
Size: 633 Bytes
Versions: 4
Compression:
Stored size: 633 Bytes
Contents
require 'json' module Dogviz class SigmaGraphHash < Hash def initialize(hash) hash.each { |k, v| self[k] = v } end 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 private def get_json_filename(type_to_filename) type = type_to_filename.keys.first raise StandardError.new("json output only supported, not #{type}") unless type == :json type_to_filename[type] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dogviz-0.0.22 | lib/dogviz/sigma_graph_hash.rb |
dogviz-0.0.21 | lib/dogviz/sigma_graph_hash.rb |
dogviz-0.0.20 | lib/dogviz/sigma_graph_hash.rb |
dogviz-0.0.19 | lib/dogviz/sigma_graph_hash.rb |