Module: Switchman::Shackles::ClassMethods

Defined in:
lib/switchman/shackles.rb

Instance Method Summary collapse

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



20
21
22
23
24
25
# File 'lib/switchman/shackles.rb', line 20

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
16
# File 'lib/switchman/shackles.rb', line 10

def activate!(environment)
  environment ||= :master
  activated_environments << environment
  old_environment = self.environment
  @environment = environment
  old_environment
end

#ensure_handlerObject



4
5
6
# File 'lib/switchman/shackles.rb', line 4

def ensure_handler
  raise "This should not be called with switchman installed"
end