Class: Archipelago::Client::Base
- Inherits:
-
Object
- Object
- Archipelago::Client::Base
- Defined in:
- lib/archipelago/client.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#jockey ⇒ Object
readonly
Returns the value of attribute jockey.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
Initialize an instance using Archipelago::Disco::MC or :jockey if given, or a new Archipelago::Disco::Jockey if none, that looks for new services :initial_service_update_interval or INITIAL_SERVICE_UPDATE_INTERVAL, when it starts and never slower than every :maximum_service_update_interval or MAXIMUM_SERVICE_UPDATE_INTERVAL.
-
#setup(options = {}) ⇒ Object
Sets up this instance with the given
options. -
#stop! ⇒ Object
Stops the service update thread for this Pirate and also unpublishes and/or stops the Jockey.
-
#update_services! ⇒ Object
Override this to do whatever you want to when finding services.
Constructor Details
#initialize(options = {}) ⇒ Base
Initialize an instance using Archipelago::Disco::MC or :jockey if given, or a new Archipelago::Disco::Jockey if none, that looks for new services :initial_service_update_interval or INITIAL_SERVICE_UPDATE_INTERVAL, when it starts and never slower than every :maximum_service_update_interval or MAXIMUM_SERVICE_UPDATE_INTERVAL.
36 37 38 |
# File 'lib/archipelago/client.rb', line 36 def initialize( = {}) setup() end |
Instance Attribute Details
#jockey ⇒ Object (readonly)
Returns the value of attribute jockey.
28 29 30 |
# File 'lib/archipelago/client.rb', line 28 def jockey @jockey end |
Instance Method Details
#setup(options = {}) ⇒ Object
Sets up this instance with the given options.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/archipelago/client.rb', line 42 def setup( = {}) @jockey.stop! if defined?(@jockey) && @jockey != Archipelago::Disco::MC if defined?(Archipelago::Disco::MC) @jockey = [:jockey] || Archipelago::Disco::MC else @jockey = [:jockey] || Archipelago::Disco::Jockey.new end @initial_service_update_interval = [:initial_service_update_interval] || INITIAL_SERVICE_UPDATE_INTERVAL @maximum_service_update_interval = [:maximum_service_update_interval] || MAXIMUM_SERVICE_UPDATE_INTERVAL end |
#stop! ⇒ Object
Stops the service update thread for this Pirate and also unpublishes and/or stops the Jockey.
58 59 60 61 62 63 |
# File 'lib/archipelago/client.rb', line 58 def stop! @service_update_thread.kill if @service_update_thread unless defined?(Archipelago::Disco::MC) && @jockey && @jockey == Archipelago::Disco::MC @jockey.stop! end end |
#update_services! ⇒ Object
Override this to do whatever you want to when finding services.
68 69 70 |
# File 'lib/archipelago/client.rb', line 68 def update_services! # /moo end |