Module: Labor
- Defined in:
- lib/labor/config.rb,
lib/labor.rb,
lib/labor/worker.rb,
lib/labor/ability.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: Ability, Config, Worker
Constant Summary collapse
- VERSION =
Version = "0.1.3"
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.
57 58 59 |
# File 'lib/labor.rb', line 57 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.
52 53 54 |
# File 'lib/labor.rb', line 52 def self.config @config ||= Labor::Config.new end |
.config=(file_name) ⇒ Object
44 45 46 |
# File 'lib/labor.rb', line 44 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.
31 32 33 |
# File 'lib/labor.rb', line 31 def self.servers @servers || ["localhost:#{Gearman::Util::DEFAULT_PORT}"] end |
.servers=(servers) ⇒ Object
23 24 25 |
# File 'lib/labor.rb', line 23 def self.servers=(servers) @servers = servers end |