class ZombieScout::MethodCallFinder
Public Class Methods
new(ruby_project)
click to toggle source
# File lib/zombie_scout/method_call_finder.rb, line 4 def initialize(ruby_project) @ruby_project = ruby_project end
Public Instance Methods
count_calls(method_name)
click to toggle source
# File lib/zombie_scout/method_call_finder.rb, line 8 def count_calls(method_name) method_name = method_name.to_s # zero-or-more spaces, =, and NOT a > (so we don't match hashrockets) method_name.sub!(/=$/, ' *=[^>]') find_occurrances(method_name).size end
Private Instance Methods
files_to_search()
click to toggle source
# File lib/zombie_scout/method_call_finder.rb, line 32 def files_to_search @ruby_project.folders.join(' ') end
find_occurrances(method_name)
click to toggle source
# File lib/zombie_scout/method_call_finder.rb, line 19 def find_occurrances(method_name) # TODO somehow expose some of this config for end-users command = "grep -rnw #{includes} --binary-files=without-match \"#{method_name}\" #{files_to_search} Rakefile" grep_lines = `#{command}` grep_lines.split("\n") end
includes()
click to toggle source
# File lib/zombie_scout/method_call_finder.rb, line 26 def includes %w(*.rb *.erb *.haml *.rake Rakefile).map { |inc| "--include=\"#{inc}\"" }.join(' ') end