Module: Switcher::Object
- Defined in:
- lib/switcher/adapters/object.rb
Defined Under Namespace
Modules: ClassMethods, Initializer
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Method Details
#switch(event, *args) ⇒ Object
58
59
60
|
# File 'lib/switcher/adapters/object.rb', line 58
def switch(event, *args)
switch_from(self.class, event, *args)
end
|
#switch_from(orig, event, *args) ⇒ Object
62
63
64
65
66
67
68
69
70
|
# File 'lib/switcher/adapters/object.rb', line 62
def switch_from(orig, event, *args)
return false unless (self.respond_to?(:"can_#{event}?") and self.send(:"can_#{event}?"))
self.class.class_variable_get(:@@__specs__).each do |spc|
self.instance_variable_get(:"@#{spc.name}_statement").publish(event, orig, args)
end
true
end
|