lib/writer/symbolmatrix.rb in symbolmatrix-1.1.2 vs lib/writer/symbolmatrix.rb in symbolmatrix-1.1.3
- old
+ new
@@ -29,9 +29,29 @@
the_hash[key] = value
end
end
the_hash
end
+
+ def json
+ @source.to_json
+ end
+
+ def yaml
+ string_key_hash.to_yaml
+ end
+
+ def string_key_hash
+ the_hash = {}
+ @source.each do |key, value|
+ if value.respond_to? :to
+ the_hash[key.to_s] = value.to.string_key_hash
+ else
+ the_hash[key.to_s] = value
+ end
+ end
+ the_hash
+ end
end
end
class SymbolMatrix < Hash
include Discoverer::Writer
\ No newline at end of file