Method: Lockistics::Meterable::ClassMethods#meter_wrap

Defined in:
lib/lockistics/meterable.rb

#meter_wrap(meth_name) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/lockistics/meterable.rb', line 11

def meter_wrap(meth_name)
  @@_metered_methods[meth_name][:method] = instance_method(meth_name)
  define_method(meth_name) do |*args, &block|
    Lockistics.meter("#{@@_metered_methods[meth_name][:options][:prefix]}_#{meth_name}") do
      @@_metered_methods[meth_name][:method].bind(self).call *args, &block
    end
  end
end