Module: Labor
- Defined in:
- lib/labor/config.rb,
lib/labor.rb,
lib/labor/worker.rb,
lib/labor/helpers.rb,
lib/labor/version.rb
Overview
Configuration manager for the worker. Treat it like a Hash. A hash that has a tiny DSL for setting values to it and supports grouping.
For example:
config = Config.new
config[:foo] = "bar"
config.set :hello, "world"
config.group :a_group do
set :three_two_one, "let's jam!"
end
config.foo #=> "bar"
config.hello #=> "world"
config.a_group.three_two_one #=> "let's jam"
Defined Under Namespace
Modules: Helpers Classes: Config, Worker
Constant Summary collapse
- VERSION =
Version = "0.1.2"
Class Attribute Summary collapse
-
.verbose ⇒ Object
Returns the value of attribute verbose.
Class Method Summary collapse
-
.config ⇒ Object
Returns the configuration object for our application.
-
.config=(file_name) ⇒ Object
Loads in a config file.
-
.servers ⇒ Object
Returns the list of server addresses we’d like to connect to.
-
.servers=(servers) ⇒ Object
Sets the server addresses that we’d like to connect to.
Class Attribute Details
.verbose ⇒ Object
Returns the value of attribute verbose.
56 57 58 |
# File 'lib/labor.rb', line 56 def verbose @verbose end |
Class Method Details
.config ⇒ Object
Returns the configuration object for our application.
Returns the Labor::Config instance. Defaults to a new config
if nothing has been set.
51 52 53 |
# File 'lib/labor.rb', line 51 def self.config @config ||= Labor::Config.new end |
.config=(file_name) ⇒ Object
43 44 45 |
# File 'lib/labor.rb', line 43 def self.config=(file_name) @config = Labor::Config.new.load file_name end |
.servers ⇒ Object
Returns the list of server addresses we’d like to connect to.
Returns the Array of server addresses. Defaults to localhost:4730
if nothing has been set.
30 31 32 |
# File 'lib/labor.rb', line 30 def self.servers @servers || ["localhost:#{Gearman::Util::DEFAULT_PORT}"] end |
.servers=(servers) ⇒ Object
22 23 24 |
# File 'lib/labor.rb', line 22 def self.servers=(servers) @servers = servers end |