Module: RubySnooper

Defined in:
lib/ruby_snooper.rb,
lib/ruby_snooper/version.rb,
lib/ruby_snooper/trace_writer.rb

Defined Under Namespace

Classes: Error, TraceWriter

Constant Summary collapse

CLASS_NAME_PATTERN =
/\<class\:(\w+)\>/.freeze
VERSION =
"0.1.3"

Instance Method Summary collapse

Instance Method Details

#snoop(*method_names) ⇒ Object



9
10
11
# File 'lib/ruby_snooper.rb', line 9

def snoop(*method_names)
  prepend to_prepend(method_names)
end

#snoop_class_methods(*method_names) ⇒ Object



13
14
15
16
17
# File 'lib/ruby_snooper.rb', line 13

def snoop_class_methods(*method_names)
  Kernel.const_get(caller_locations.first.label.match(CLASS_NAME_PATTERN)[1])
        .singleton_class
        .prepend(to_prepend(method_names))
end