Class: ObjectsFramework::Hooks
- Inherits:
-
Object
- Object
- ObjectsFramework::Hooks
- Defined in:
- lib/objectsframework/hooks.rb
Class Method Summary collapse
Class Method Details
.continue ⇒ Object
16 17 18 |
# File 'lib/objectsframework/hooks.rb', line 16 def self.continue return 0 end |
.fire(filter, klass) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/objectsframework/hooks.rb', line 3 def self.fire(filter, klass) hooks_to_execute = klass.class.get_hooks.select { |hook| hook[:filter] == filter } hooks_to_execute.each do |hook| result = klass.send(hook[:method].to_sym) return result unless result == 0 end return 0 end |
.hook_exists?(filter, klass) ⇒ Boolean
12 13 14 |
# File 'lib/objectsframework/hooks.rb', line 12 def self.hook_exists?(filter,klass) !(klass.class.get_hooks.select{|hook| hook[:filter] == filter}).empty? end |