class PubSub::Subscriptions
Attributes
config[R]
Public Class Methods
lint!()
click to toggle source
# File lib/pub_sub/subscriptions.rb, line 17 def self.lint! instance.lint! end
load!()
click to toggle source
# File lib/pub_sub/subscriptions.rb, line 12 def self.load! PubSub.subscriptions = Subscriptions.instance PubSub.subscriptions.register(:all) end
new()
click to toggle source
# File lib/pub_sub/subscriptions.rb, line 25 def initialize @config = YAML.load_file(self.class.subscriptions_path) end
Public Instance Methods
clear!()
click to toggle source
# File lib/pub_sub/subscriptions.rb, line 41 def clear! Wisper.clear end
lint!()
click to toggle source
# File lib/pub_sub/subscriptions.rb, line 21 def lint! Linter.new(config).lint! end
register(scope = :all)
click to toggle source
# File lib/pub_sub/subscriptions.rb, line 29 def register(scope = :all) (scope == :all ? config : config.slice(scope.to_s)).each do |domain_name, subscriptions| subscriptions.each do |event_name, subscription_type| options = {} options[:on] = event_name unless event_name == 'all_events' options[:broadcaster] = subscription_type == 'sync' ? :default : subscription_type.to_sym Wisper.subscribe("::#{domain_name.camelize}".constantize, options) end end end