Class: MandrillQueue::Configuration
- Inherits:
-
Object
- Object
- MandrillQueue::Configuration
- Defined in:
- lib/mandrill_queue/configuration.rb
Constant Summary collapse
- ACCESSORS =
[:message_defaults, :resque, :default_worker_class, :default_queue, :api_key, :logger, :adapter, :adapter_options]
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #each_key(&block) ⇒ Object
-
#initialize(defaults = {}, &block) ⇒ Configuration
constructor
A new instance of Configuration.
- #reset {|_self| ... } ⇒ Object
- #set(hash) ⇒ Object
Constructor Details
#initialize(defaults = {}, &block) ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 |
# File 'lib/mandrill_queue/configuration.rb', line 7 def initialize(defaults = {}, &block) set(defaults) instance_eval(&block) if block_given? end |
Class Method Details
.accessors ⇒ Object
38 39 40 |
# File 'lib/mandrill_queue/configuration.rb', line 38 def self.accessors ACCESSORS end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/mandrill_queue/configuration.rb', line 16 def [](key) send(key) end |
#[]=(key, value) ⇒ Object
12 13 14 |
# File 'lib/mandrill_queue/configuration.rb', line 12 def []=(key, value) send("#{key}=", value) end |
#each_key(&block) ⇒ Object
28 29 30 |
# File 'lib/mandrill_queue/configuration.rb', line 28 def each_key(&block) ACCESSORS.each(&block) end |
#reset {|_self| ... } ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/mandrill_queue/configuration.rb', line 20 def reset ACCESSORS.each do |key| send("#{key}=", nil) end yield self if block_given? end |
#set(hash) ⇒ Object
32 33 34 35 36 |
# File 'lib/mandrill_queue/configuration.rb', line 32 def set(hash) each_key do |k, v| send("#{k}=", hash[k]) end end |