module Kojak::Inspector

Public: Extend your class with this inspector module to get investigation functionality.

Example

class Dummy
  investigate :foo, :bar

  def foo
    *snip*...
  end

  def bar
    *snip*...
  end
end

Dummy.investigate! # ... or Kojak.investigate_all!

Public Class Methods

extended(cls) click to toggle source
# File lib/kojak/inspector.rb, line 39
def self.extended(cls)
  Kojak.mark_for_investigation(cls)
end

Public Instance Methods

investigate(*names) click to toggle source

Public: Marks given methods for investigation.

names - The Array of method names to investigate.

Returns Array with names of all methods being under investigation.

# File lib/kojak/inspector.rb, line 48
def investigate(*names)
  Kojak.mark_for_investigation(self)
  @__kojak_investigate ||= []
  @__kojak_investigate.concat(names).uniq!
end
investigate!() click to toggle source

Public: Enables investigation of caller class.

# File lib/kojak/inspector.rb, line 55
def investigate!
  @__kojak_investigate.each do |name|
    m = instance_method(name)
    Kojak.register_investigator_for!(self, m)
  end
end