Module: Instrumentable::ClassMethods
- Defined in:
- lib/instrumentable.rb
Instance Method Summary collapse
-
#class_instrument_method(klass, method_to_instrument, event_name, payload = {}) ⇒ Object
Class implementation of
instrument_method. -
#instrument_method(method_to_instrument, event_name, payload = {}) ⇒ Object
Wraps method_to_instrument in an AS:N:instrument with event_name as the name and passes the payload given to it.
Instance Method Details
#class_instrument_method(klass, method_to_instrument, event_name, payload = {}) ⇒ Object
Class implementation of instrument_method
63 64 65 66 67 |
# File 'lib/instrumentable.rb', line 63 def class_instrument_method(klass, method_to_instrument, event_name, payload={}) class << klass; self; end.class_eval do Instrumentality.begin(self, method_to_instrument, event_name, payload) end end |
#instrument_method(method_to_instrument, event_name, payload = {}) ⇒ Object
Wraps method_to_instrument in an AS:N:instrument with event_name as the name and passes the payload given to it.
Payload is a hash of payload_name to payload_value
payload_value supported types:
String:: Passes the string straight to the payload_name
and does nothing else with it
Symbol:: A method to call on the class being instrumented
Proc:: A proc to call with the object
All of these have their value then calculated (if needed) and set
as the value for the given key
58 59 60 |
# File 'lib/instrumentable.rb', line 58 def instrument_method(method_to_instrument, event_name, payload={}) Instrumentality.begin(self, method_to_instrument, event_name, payload) end |