Class: Jobi::Configuration
- Inherits:
-
Object
- Object
- Jobi::Configuration
- Defined in:
- lib/jobi/configuration.rb
Instance Attribute Summary collapse
-
#act_as_consumer ⇒ Object
Returns the value of attribute act_as_consumer.
-
#act_as_publisher ⇒ Object
Returns the value of attribute act_as_publisher.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#jobs ⇒ Object
Returns the value of attribute jobs.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
- #log_level ⇒ Object
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#rabbitmq_config ⇒ Object
readonly
Returns the value of attribute rabbitmq_config.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #rabbitmq(options = {}) ⇒ Object
- #setup_logger ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 |
# File 'lib/jobi/configuration.rb', line 7 def initialize setup_client setup_log_config setup_logger setup_pub_sub_config setup_jobs rabbitmq end |
Instance Attribute Details
#act_as_consumer ⇒ Object
Returns the value of attribute act_as_consumer.
3 4 5 |
# File 'lib/jobi/configuration.rb', line 3 def act_as_consumer @act_as_consumer end |
#act_as_publisher ⇒ Object
Returns the value of attribute act_as_publisher.
3 4 5 |
# File 'lib/jobi/configuration.rb', line 3 def act_as_publisher @act_as_publisher end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/jobi/configuration.rb', line 5 def client @client end |
#jobs ⇒ Object
Returns the value of attribute jobs.
3 4 5 |
# File 'lib/jobi/configuration.rb', line 3 def jobs @jobs end |
#log_file ⇒ Object
Returns the value of attribute log_file.
3 4 5 |
# File 'lib/jobi/configuration.rb', line 3 def log_file @log_file end |
#log_level ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jobi/configuration.rb', line 16 def log_level case @log_level when :info Logger::INFO when :warn Logger::WARN when :debug Logger::DEBUG end end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/jobi/configuration.rb', line 5 def logger @logger end |
#rabbitmq_config ⇒ Object (readonly)
Returns the value of attribute rabbitmq_config.
5 6 7 |
# File 'lib/jobi/configuration.rb', line 5 def rabbitmq_config @rabbitmq_config end |
Instance Method Details
#rabbitmq(options = {}) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/jobi/configuration.rb', line 27 def rabbitmq( = {}) @rabbitmq_config ||= Jobi::Config::Rabbitmq.new @client = :rabbitmq .keys.each do |key| @rabbitmq_config.send("#{key}=", [key]) end end |
#setup_logger ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/jobi/configuration.rb', line 36 def setup_logger @logger = if @log_file Logger.new(@log_file) else Logger.new(STDOUT) end @logger.level = @log_level end |