Module: Switchman::Shackles::ClassMethods
- Defined in:
- lib/switchman/shackles.rb
Instance Method Summary collapse
-
#activate(environment) ⇒ Object
since activate! really is just a variable swap now, it’s safe to use in the ensure block, simplifying the implementation.
-
#activate!(environment) ⇒ Object
drops the save_handler and ensure_handler calls from the vanilla Shackles’ implementation.
- #ensure_handler ⇒ Object
Instance Method Details
#activate(environment) ⇒ Object
since activate! really is just a variable swap now, it’s safe to use in the ensure block, simplifying the implementation
19 20 21 22 23 24 |
# File 'lib/switchman/shackles.rb', line 19 def activate(environment) old_environment = activate!(environment) yield ensure activate!(old_environment) end |
#activate!(environment) ⇒ Object
drops the save_handler and ensure_handler calls from the vanilla Shackles’ implementation.
10 11 12 13 14 15 |
# File 'lib/switchman/shackles.rb', line 10 def activate!(environment) environment ||= :master old_environment = self.environment @environment = environment old_environment end |
#ensure_handler ⇒ Object
4 5 6 |
# File 'lib/switchman/shackles.rb', line 4 def ensure_handler raise "This should not be called with switchman installed" end |