Module: Dilation::Utils::Events::ClassMethods

Defined in:
lib/dilation/utils/events.rb

Instance Method Summary collapse

Instance Method Details

#event(*names) ⇒ Object

Defines one or more events with the name and the __name variant

Parameters:

  • names (Array<String>, Array<Symbol>)

    the names of the events to create



32
33
34
35
36
37
# File 'lib/dilation/utils/events.rb', line 32

def event(*names)
  names.each do |name|
    define_method(name) { fire name }
    alias_method :"__#{name}", name
  end
end