Class: Switchboard::Commands::PubSub::Options
- Inherits:
-
Switchboard::Command
- Object
- Switchboard::Command
- Switchboard::Commands::PubSub::Options
- Defined in:
- lib/switchboard/commands/pubsub/options.rb
Constant Summary
Constants inherited from Switchboard::Command
Switchboard::Command::DEFAULT_OPTIONS, Switchboard::Command::OPTIONS
Class Method Summary collapse
Methods inherited from Switchboard::Command
description, help, to_command, to_command_name
Class Method Details
.options(opts) ⇒ Object
7 8 9 10 |
# File 'lib/switchboard/commands/pubsub/options.rb', line 7 def self.(opts) super(opts) opts.on("--subscriber=jid", String, "Specifies the subscriber to retrieve options for.") { |v| OPTIONS["pubsub.subscriber"] = v } end |
.run! ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/switchboard/commands/pubsub/options.rb', line 12 def self.run! switchboard = Switchboard::Client.new do defer :options_retrieved do (OPTIONS["pubsub.node"], OPTIONS["pubsub.subscriber"] || OPTIONS["jid"]) end def () if puts "Options for subscription by '#{OPTIONS["pubsub.subscriber"] || OPTIONS["jid"]}' to node '#{.node}':" ..each do |k,v| puts " " + [k, v] * ": " end else puts "Could not load options for subscription by '#{OPTIONS["pubsub.subscriber"] || OPTIONS["jid"]}' to node '#{OPTIONS["pubsub.node"]}'." end end end if defined?(OAuth) && OPTIONS["oauth"] switchboard.plug!(OAuthPubSubJack) else switchboard.plug!(PubSubJack) end switchboard.run! end |