Skip to content

Commit

Permalink
Send and raise weren't passing their blocks along
Browse files Browse the repository at this point in the history
  • Loading branch information
msaspence committed Apr 25, 2014
1 parent 27ecf71 commit 9f0156b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/mongo-lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def self.configure options = {}, &block
expire_in: 10,
should_raise: false,
driver: options[:driver] || (require('mongo-lock/drivers/mongo') && ::Mongo::Lock::Drivers::Mongo),
owner: Proc.new { "#{`hostname`.strip}:#{Process.pid}:#{Thread.object_id}" }
owner: Proc.new { "#{`hostname`.strip}:#{Process.pid}:#{Thread.current.object_id}" }
}
defaults = defaults.merge(@@default_configuration) if defined?(@@default_configuration) && @@default_configuration
@@default_configuration = Configuration.new(defaults, options, &block)
Expand Down
16 changes: 8 additions & 8 deletions lib/mongo-lock/send_with_raise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ def send_with_raise method, *args
self.send(method, *args)
end

def acquire! options = {}
send_with_raise :acquire, options
def acquire! options = {}, &block
send_with_raise :acquire, options, &block
end

def release! options = {}
send_with_raise :release, options
def release! options = {}, &block
send_with_raise :release, options, &block
end

def extend_by! time, options = {}
send_with_raise :extend_by, time, options
def extend_by! time, options = {}, &block
send_with_raise :extend_by, time, options, &block
end

def extend! options = {}
send_with_raise :extend, options
def extend! options = {}, &block
send_with_raise :extend, options, &block
end

end
Expand Down
2 changes: 1 addition & 1 deletion spec/configure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
end

it "sets default owner" do
expect(Mongo::Lock.configuration.owner).to eql "#{`hostname`.strip}:#{Process.pid}:#{Thread.object_id}"
expect(Mongo::Lock.configuration.owner).to eql "#{`hostname`.strip}:#{Process.pid}:#{Thread.current.object_id}"
end

it "sets default should_raise" do
Expand Down

0 comments on commit 9f0156b

Please sign in to comment.