Class: Avm::Tools::Runner::Source::Subs
- Inherits:
-
Object
- Object
- Avm::Tools::Runner::Source::Subs
- Defined in:
- lib/avm/tools/runner/source/subs.rb
Constant Summary collapse
- PADDING =
' '
Instance Method Summary collapse
- #output_content ⇒ Object
- #run ⇒ Object
- #start_banner ⇒ Object
- #sub_info_label(sub) ⇒ Object
- #sub_label(sub, level) ⇒ Object
- #sub_output_content_lines(sub, level) ⇒ Object
- #sub_self_label(sub, level) ⇒ Object
- #sub_subs_output_content_lines(sub, level) ⇒ Object
Instance Method Details
#output_content ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/avm/tools/runner/source/subs.rb', line 30 def output_content b = [] runner_context.call(:subject).subs.each do |sub| b += sub_output_content_lines(sub, 0) end b.map { |line| "#{line}\n" }.join end |
#run ⇒ Object
19 20 21 22 |
# File 'lib/avm/tools/runner/source/subs.rb', line 19 def run run_output end |
#start_banner ⇒ Object
24 25 26 27 28 |
# File 'lib/avm/tools/runner/source/subs.rb', line 24 def infov 'Include PATH', runner_context.call(:subject).subs_include_path infov 'Exclude PATH', runner_context.call(:subject).subs_exclude_path infov 'Count', runner_context.call(:subject).subs.count end |
#sub_info_label(sub) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/avm/tools/runner/source/subs.rb', line 38 def sub_info_label(sub) return '' unless parsed.info? ' [' + { # rubocop:disable Style/StringConcatenation 'CLASS' => sub.class.name, 'SCM' => sub.scm.class.name }.map { |k, v| "#{k}: #{v}" }.join(', ') + ']' end |
#sub_label(sub, level) ⇒ Object
47 48 49 |
# File 'lib/avm/tools/runner/source/subs.rb', line 47 def sub_label(sub, level) sub_self_label(sub, level) + sub_info_label(sub) end |
#sub_output_content_lines(sub, level) ⇒ Object
59 60 61 |
# File 'lib/avm/tools/runner/source/subs.rb', line 59 def sub_output_content_lines(sub, level) [sub_label(sub, level)] + sub_subs_output_content_lines(sub, level) end |
#sub_self_label(sub, level) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/avm/tools/runner/source/subs.rb', line 51 def sub_self_label(sub, level) if parsed.tree? (PADDING * level) + sub.relative_path.to_s else sub.path.relative_path_from(runner_context.call(:subject).path).to_s end end |
#sub_subs_output_content_lines(sub, level) ⇒ Object
63 64 65 66 67 |
# File 'lib/avm/tools/runner/source/subs.rb', line 63 def sub_subs_output_content_lines(sub, level) return [] unless parsed.recursive? sub.subs.flat_map { |sub_sub| sub_output_content_lines(sub_sub, level + 1) } end |