Class: GraphAnalyser

Inherits:
Object
  • Object
show all
Defined in:
lib/graphing/graph_analyser.rb

Instance Method Summary collapse

Constructor Details

#initializeGraphAnalyser

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

#jsonObject



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