Method: JSONGraph.parse
- Defined in:
- lib/graphs/json.rb
.parse(content) ⇒ Graph
Parse some JSON text and return a new Graph object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/graphs/json.rb', line 45 def self.parse(content) if (content.nil? || content.length == 0) return Graph.new([],[]) end content = JSON.parse content nodes = content['nodes'] edges = content['edges'] Graph.new(nodes, edges) end |