Skip to content
Browse files

Fix 1.8.7 compliance

  • Loading branch information...
1 parent be074d2 commit e0af52642cd988674d9e789d5cfde105f9567b99 @grobie grobie committed May 22, 2012
Showing with 10 additions and 7 deletions.
  1. +1 −0 .travis.yml
  2. +1 −0 CHANGELOG.md
  3. +8 −7 lib/master_slave_adapter.rb
View
1 .travis.yml
@@ -1,4 +1,5 @@
language: ruby
rvm:
+ - 1.8.7
- 1.9.2
- 1.9.3
View
1 CHANGELOG.md
@@ -7,6 +7,7 @@
* #current_connection=
* #current_clock=
* #slave_consistent?
+* Fix 1.8.7 compliance
# 0.2.0 (April 2, 2012)
View
15 lib/master_slave_adapter.rb
@@ -223,14 +223,14 @@ def reset!
connections.each { |c| c.reset! }
end
- def cache(&block)
- connections.inject(block) do |block, connection|
+ def cache(&blk)
+ connections.inject(blk) do |block, connection|
lambda { connection.cache(&block) }
end.call
end
- def uncached(&block)
- connections.inject(block) do |block, connection|
+ def uncached(&blk)
+ connections.inject(blk) do |block, connection|
lambda { connection.uncached(&block) }
end.call
end
@@ -248,7 +248,8 @@ def execute(*args)
# ADAPTER INTERFACE DELEGATES ===========================================
- def self.rescued_delegate(*methods, options)
+ def self.rescued_delegate(*methods)
+ options = methods.pop
to, fallback = options.values_at(:to, :fallback)
file, line = caller.first.split(':', 2)
@@ -260,11 +261,11 @@ def #{method}(*args, &block)
begin
#{to}.__send__(:#{method}, *args, &block)
rescue MasterUnavailable
- #{fallback ? "#{fallback}.__send__(:#{method}, *args, *block)" : "raise"}
+ #{fallback ? "#{fallback}.__send__(:#{method}, *args, &block)" : "raise"}
rescue => exception
if master_connection?(#{to}) && connection_error?(exception)
reset_master_connection
- #{fallback ? "#{fallback}.__send__(:#{method}, *args, *block)" : "raise MasterUnavailable"}
+ #{fallback ? "#{fallback}.__send__(:#{method}, *args, &block)" : "raise MasterUnavailable"}
else
raise
end

0 comments on commit e0af526

Please sign in to comment.
Something went wrong with that request. Please try again.