Module: SwitchPoint::Model::ClassMethods
- Defined in:
- lib/switch_point/model.rb
Instance Method Summary collapse
- #connection_with_switch_point ⇒ Object
- #switch_point_proxy ⇒ Object
- #use_switch_point(name) ⇒ Object
- #with_readonly(&block) ⇒ Object
- #with_writable(&block) ⇒ Object
Instance Method Details
#connection_with_switch_point ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/switch_point/model.rb', line 13 def connection_with_switch_point if @switch_point_name switch_point_proxy.connection else connection_without_switch_point end end |
#switch_point_proxy ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/switch_point/model.rb', line 42 def switch_point_proxy if @switch_point_name ProxyRepository.checkout(@switch_point_name) else nil end end |
#use_switch_point(name) ⇒ Object
37 38 39 40 |
# File 'lib/switch_point/model.rb', line 37 def use_switch_point(name) assert_existing_switch_point!(name) @switch_point_name = name end |
#with_readonly(&block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/switch_point/model.rb', line 21 def with_readonly(&block) if switch_point_proxy switch_point_proxy.with_readonly(&block) else block.call end end |
#with_writable(&block) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/switch_point/model.rb', line 29 def with_writable(&block) if switch_point_proxy switch_point_proxy.with_writable(&block) else block.call end end |