Module: Easyhooks::ClassMethods

Defined in:
lib/easyhooks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#easyhooks_specObject (readonly)

Returns the value of attribute easyhooks_spec.



14
15
16
# File 'lib/easyhooks.rb', line 14

def easyhooks_spec
  @easyhooks_spec
end

Instance Method Details

#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

#easyhooks_actionsObject



27
28
29
# File 'lib/easyhooks.rb', line 27

def easyhooks_actions
  @easyhooks_spec.actions
end