Class: Nokogiri::XML::XPathContext

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/patches/nokogiri_profiling.rb

Instance Method Summary collapse

Instance Method Details

#evaluate(search_path, handler = nil) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/kitchen/patches/nokogiri_profiling.rb', line 44

def evaluate(search_path, handler=nil)
  puts search_path if ENV['VERBOSE_PROFILE']

  PROFILE_DATA[search_path] ||= Hash.new(0)
  PROFILE_DATA[search_path][:count] += 1

  start_time = Time.now
  original_evaluate(search_path, handler).tap do
    PROFILE_DATA[search_path][:time] += Time.now - start_time
  end
end

#original_evaluateObject



43
# File 'lib/kitchen/patches/nokogiri_profiling.rb', line 43

alias_method :original_evaluate, :evaluate