Method: Easyhooks::ClassMethods#easyhooks

Defined in:
lib/easyhooks.rb

#easyhooks(type = :default, args = {}, &specification) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/easyhooks.rb', line 16

def easyhooks(type = :default, args = {}, &specification)
  if type.is_a?(Hash)
    args = type
    type = :default
  end
  # get self.class replacing :: from the module::class name with _
  # e.g. MyModule::MyClass becomes MyModule_MyClass
  klass_name = self.name.to_s.gsub('::', '_')
  assign_easyhooks Specification.new(klass_name, type, args, &specification)
end