Class: GraphAnalyser
- Inherits:
-
Object
- Object
- GraphAnalyser
- Defined in:
- lib/graphing/graph_analyser.rb
Instance Method Summary collapse
-
#initialize ⇒ GraphAnalyser
constructor
A new instance of GraphAnalyser.
- #json ⇒ Object
- #parse(code) ⇒ Object
Constructor Details
#initialize ⇒ GraphAnalyser
Returns a new instance of GraphAnalyser.
2 3 4 |
# File 'lib/graphing/graph_analyser.rb', line 2 def initialize @analysis = { :graphdata => {} } end |
Instance Method Details
#json ⇒ Object
16 17 18 |
# File 'lib/graphing/graph_analyser.rb', line 16 def json @analysis.to_json end |
#parse(code) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/graphing/graph_analyser.rb', line 6 def parse code js_lint = JSLint.new code js_lint.tree.each do |node| if node["value"].eql?("function") and not node["arity"].eql?("string") @functions << {node["name"]=> 1} end end end |