Skip to content

Commit

Permalink
fix up membership_subscription and update deps on zk
Browse files Browse the repository at this point in the history
  • Loading branch information
slyphon committed May 28, 2012
1 parent ceeae4a commit 254839c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 7 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
source :rubygems

gem 'zk', :path => '~/zk'
# git 'git://github.com/slyphon/zookeeper.git', :ref => '8dfdd6be' do
# gem 'zookeeper', '>= 1.0.0.beta.1'
# end

git 'git://github.com/slyphon/zk', :ref => '41bfd35' do
gem 'zk'
end

gem 'pry', :group => [:development, :test]

Expand Down
20 changes: 7 additions & 13 deletions lib/zk-group/membership_subscription.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
module ZK
module Group
class MembershipSubscription
class MembershipSubscription < ZK::Subscription::Base
include ZK::Logging

attr_reader :group, :opts
:callable
attr_reader :opts

alias group parent

def initialize(group, opts, block)
raise ArgumentError, "block must repsond_to?(:call)" unless block.respond_to?(:call)
@group = group
super(group, block)
@opts = opts
@callable = block
@threaded_callback = ThreadedCallback.new(block)
end

def notify(last_members, current_members)
Expand All @@ -24,18 +22,14 @@ def notify(last_members, current_members)
current_members = current_members.map { |m| File.join(group_path, m) }
end

@threaded_callback.call(last_members, current_members)
call(last_members, current_members)
end

def absolute_paths?
opts[:absolute]
end

def unregister
@threaded_callback.shutdown
group.unregister(self)
end
alias unsubscribe unregister
protected :call
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion zk-group.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Part of the ZK project.
}
s.homepage = "https://github.com/slyphon/zk-group"

s.add_runtime_dependency 'zk', '~> 1.1.0'
s.add_runtime_dependency 'zk', '~> 1.6.0'

s.files = `git ls-files`.split($\)
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Expand Down

0 comments on commit 254839c

Please sign in to comment.