Class: Society::Parser
- Inherits:
-
Fukuzatsu::Parser
- Object
- Fukuzatsu::Parser
- Society::Parser
- Defined in:
- lib/society/parser.rb
Instance Attribute Summary collapse
-
#parsed_files ⇒ Object
readonly
Returns the value of attribute parsed_files.
Instance Method Summary collapse
- #class_graph ⇒ Object
-
#initialize(start_path) ⇒ Parser
constructor
A new instance of Parser.
- #matrix(graph) ⇒ Object
- #method_graph ⇒ Object
- #reset_output_directory ⇒ Object
Constructor Details
#initialize(start_path) ⇒ Parser
Returns a new instance of Parser.
9 10 11 12 |
# File 'lib/society/parser.rb', line 9 def initialize(start_path) super(start_path, :none, 0) @parsed_files = parse_files end |
Instance Attribute Details
#parsed_files ⇒ Object (readonly)
Returns the value of attribute parsed_files.
7 8 9 |
# File 'lib/society/parser.rb', line 7 def parsed_files @parsed_files end |
Instance Method Details
#class_graph ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/society/parser.rb', line 14 def class_graph @class_graph ||= begin graph = ObjectGraph.new graph.nodes = parsed_files.map do |parsed_file| Node.new( name: parsed_file.class_name, address: parsed_file.path_to_file, edges: parsed_file.class_references ) end graph end end |
#matrix(graph) ⇒ Object
43 44 45 |
# File 'lib/society/parser.rb', line 43 def matrix(graph) Society::Matrix.new(graph.nodes) end |
#method_graph ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/society/parser.rb', line 28 def method_graph @method_graph ||= begin graph = ObjectGraph.new target = parsed_files.first graph.nodes = target.methods.map do |method| Node.new( name: method.name, address: target.class_name, edges: method.references ) end graph end end |
#reset_output_directory ⇒ Object
47 48 |
# File 'lib/society/parser.rb', line 47 def reset_output_directory end |