lib/switch_point/model.rb in switch_point-0.2.1 vs lib/switch_point/model.rb in switch_point-0.2.2

- old
+ new

@@ -17,23 +17,35 @@ connection_without_switch_point end end def with_readonly(&block) - switch_point_proxy.with_readonly(&block) + if switch_point_proxy + switch_point_proxy.with_readonly(&block) + else + block.call + end end def with_writable(&block) - switch_point_proxy.with_writable(&block) + if switch_point_proxy + switch_point_proxy.with_writable(&block) + else + block.call + end end def use_switch_point(name) assert_existing_switch_point!(name) @switch_point_name = name end def switch_point_proxy - ProxyRepository.checkout(@switch_point_name) + if @switch_point_name + ProxyRepository.checkout(@switch_point_name) + else + nil + end end private def assert_existing_switch_point!(name)