Class: Mire::Output::Occurrence

Inherits:
Base
  • Object
show all
Defined in:
lib/mire/output/occurrence.rb

Overview

checks for a term and print out the occurrences and the occurrences of this and so on

Instance Method Summary collapse

Methods included from ConfigurationMethods

#configuration, #excluded_file?

Instance Method Details

#check(term, levels: 2, indenting: 0, output: []) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mire/output/occurrence.rb', line 6

def check(term, levels: 2, indenting: 0, output: [])
  term = term.to_sym if term
  return unless methods[term]
  methods[term][:invocations].each_with_object(output) do |method, o|
    o << "#{' ' * indenting * 2}#{location(method)}"

    next unless levels > 0
    check(method[:method], levels: levels - 1,
                           indenting: indenting + 1,
                           output: o)
  end
  output
end