Module: Howler::Async

Defined in:
lib/howler/async.rb

Instance Method Summary collapse

Instance Method Details

#async(*methods) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/howler/async.rb', line 3

def async(*methods)
  methods = methods.to_a.flatten.compact.map(&:to_s)

  class_eval do
    methods.each do |method|
      define_singleton_method :"async_#{method}" do |*args|
        Howler::Manager.current.push(self.to_s, method.to_sym, args)
      end
    end
  end
end