Module: Tiger::ClassMethod
- Included in:
- Tiger
- Defined in:
- lib/tiger/class_method.rb
Instance Attribute Summary collapse
-
#triggers ⇒ Object
Returns the value of attribute triggers.
Instance Method Summary collapse
Instance Attribute Details
#triggers ⇒ Object
Returns the value of attribute triggers.
3 4 5 |
# File 'lib/tiger/class_method.rb', line 3 def triggers @triggers end |
Instance Method Details
#emit(name, *args) ⇒ Object
13 14 15 16 17 |
# File 'lib/tiger/class_method.rb', line 13 def emit(name, *args) trigger(name).each do |code| self.instance_exec(*args, &code) end end |
#initialize ⇒ Object
5 6 7 |
# File 'lib/tiger/class_method.rb', line 5 def initialize @triggers = {} end |
#on(name, &code) ⇒ Object
9 10 11 |
# File 'lib/tiger/class_method.rb', line 9 def on(name, &code) trigger(name).push(code) end |