Method: ClassX::Pluggable#add_event

Defined in:
lib/classx/pluggable.rb

#add_event(name, plugin, meth) ⇒ Object

register plugin and method to hook point.



72
73
74
75
76
77
78
79
80
# File 'lib/classx/pluggable.rb', line 72

def add_event name, plugin, meth
  name = name.to_s
  if self.check_events && !self.events.include?(name)
    raise "#{name.inspect} should be declared before call add_event. not in #{self.events.inspect}"
  else
    self.__classx_pluggable_events_of[name] ||= []
  end
  self.__classx_pluggable_events_of[name] << { :plugin => plugin, :method => meth }
end