Class: VisualizeRuby::Runner
- Inherits:
-
Object
- Object
- VisualizeRuby::Runner
- Defined in:
- lib/visualize_ruby/runner.rb
Instance Attribute Summary collapse
-
#calling_code ⇒ String, ...
The code that calls the graphed code.
- #in_line_local_method_calls ⇒ Object
-
#only_graphs ⇒ Object
writeonly
Sets the attribute only_graphs.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#output_format ⇒ Symbol, ...
To output DOT format as a string use String class as value.
-
#output_path ⇒ String, Pathname
Add the exe name to select a format ie.
-
#ruby_code ⇒ String, ...
The code to be graphed.
- #unique_nodes ⇒ Object writeonly
Instance Method Summary collapse
- #graphs ⇒ Object
- #options(opts = {}) ⇒ Object
- #run! ⇒ Object
- #trace(calling_code = nil, &block) ⇒ Object
Instance Attribute Details
#calling_code ⇒ String, ...
Returns The code that calls the graphed code.
6 7 8 |
# File 'lib/visualize_ruby/runner.rb', line 6 def calling_code @calling_code end |
#in_line_local_method_calls ⇒ Object
40 41 42 |
# File 'lib/visualize_ruby/runner.rb', line 40 def in_line_local_method_calls @in_line_local_method_calls ||= traced? end |
#only_graphs=(value) ⇒ Object
Sets the attribute only_graphs
18 19 20 |
# File 'lib/visualize_ruby/runner.rb', line 18 def only_graphs=(value) @only_graphs = value end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
25 26 27 |
# File 'lib/visualize_ruby/runner.rb', line 25 def output @output end |
#output_format ⇒ Symbol, ...
Returns To output DOT format as a string use String class as value.
10 11 12 |
# File 'lib/visualize_ruby/runner.rb', line 10 def output_format @output_format end |
#output_path ⇒ String, Pathname
Returns Add the exe name to select a format ie. png, jpg, svg, dot…
12 13 14 |
# File 'lib/visualize_ruby/runner.rb', line 12 def output_path @output_path end |
#ruby_code ⇒ String, ...
Returns The code to be graphed.
8 9 10 |
# File 'lib/visualize_ruby/runner.rb', line 8 def ruby_code @ruby_code end |
#unique_nodes=(value) ⇒ Object
16 17 18 |
# File 'lib/visualize_ruby/runner.rb', line 16 def unique_nodes=(value) @unique_nodes = value end |
Instance Method Details
#graphs ⇒ Object
50 51 52 53 |
# File 'lib/visualize_ruby/runner.rb', line 50 def graphs graphs = builder.graphs.map(&:name).compact [builder..fetch(:label, "default")].concat(graphs) end |
#options(opts = {}) ⇒ Object
44 45 46 47 48 |
# File 'lib/visualize_ruby/runner.rb', line 44 def (opts={}) opts.each do |key, value| public_send("#{key}=", value) end end |
#run! ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/visualize_ruby/runner.rb', line 27 def run! @run ||= begin highlight_trace @output ||= VisualizeRuby::Graphviz.new( builder, graphs: filter_graphs, unique_nodes: unique_nodes, only_graphs: only_graphs, ).to_graph({ path: output_path, format: output_format }.compact) end self end |
#trace(calling_code = nil, &block) ⇒ Object
21 22 23 |
# File 'lib/visualize_ruby/runner.rb', line 21 def trace(calling_code = nil, &block) @calling_code = calling_code || block end |