Module: Skylight::Helpers::ClassMethods
- Defined in:
- lib/skylight/helpers.rb
Overview
Instance Method Summary collapse
-
#instrument_class_method([name], opts = {}) ⇒ Object
You may also declare the methods to instrument at any time by passing the name of the method as the first argument to ‘instrument_method`.
- #instrument_method(*args, **opts) ⇒ Object
- #method_added(name) ⇒ Object private
- #singleton_method_added(name) ⇒ Object private
Instance Method Details
#instrument_class_method([name], opts = {}) ⇒ Object
129 130 131 132 133 134 |
# File 'lib/skylight/helpers.rb', line 129 def instrument_class_method(name, **opts) # NOTE: If the class is defined anonymously and then assigned to a variable this code # will not be aware of the updated name. title = "#{self}.#{name}" __sk_instrument_method_on(__sk_singleton_class, name, title, **opts) end |
#instrument_method ⇒ Object #instrument_method([name], opts = {}) ⇒ Object
85 86 87 88 89 90 91 92 |
# File 'lib/skylight/helpers.rb', line 85 def instrument_method(*args, **opts) if (name = args.pop) title = "#{self}##{name}" __sk_instrument_method_on(self, name, title, **opts) else @__sk_instrument_next_method = opts end end |
#method_added(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 16 17 18 19 |
# File 'lib/skylight/helpers.rb', line 12 def method_added(name) super if (opts = @__sk_instrument_next_method) @__sk_instrument_next_method = nil instrument_method(name, **opts) end end |
#singleton_method_added(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 25 26 27 28 29 |
# File 'lib/skylight/helpers.rb', line 22 def singleton_method_added(name) super if (opts = @__sk_instrument_next_method) @__sk_instrument_next_method = nil instrument_class_method(name, **opts) end end |