Class: BackgroundQueue::ServerLib::Config::Worker
- Inherits:
-
Object
- Object
- BackgroundQueue::ServerLib::Config::Worker
- Defined in:
- lib/background_queue/server_lib/config.rb
Overview
A server entry in the configuration
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(config_entry) ⇒ Worker
constructor
A new instance of Worker.
- #url ⇒ Object
Constructor Details
#initialize(config_entry) ⇒ Worker
Returns a new instance of Worker.
251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/background_queue/server_lib/config.rb', line 251 def initialize(config_entry) if config_entry.nil? raise BackgroundQueue::LoadError, "Missing worker url" elsif config_entry.kind_of?(String) raise BackgroundQueue::LoadError, "Missing worker url" if config_entry.strip.length == 0 begin @uri = URI.parse(config_entry) rescue URI::InvalidURIError raise BackgroundQueue::LoadError, "Invalid worker url (#{config_entry})" end else raise BackgroundQueue::LoadError, "Invalid data type (#{config_entry.class.name}), expecting String (as a url)" end end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
249 250 251 |
# File 'lib/background_queue/server_lib/config.rb', line 249 def uri @uri end |
Instance Method Details
#url ⇒ Object
266 267 268 |
# File 'lib/background_queue/server_lib/config.rb', line 266 def url @uri.to_s end |