Class: Tekeya::Configuration
- Inherits:
-
Object
- Object
- Tekeya::Configuration
- Includes:
- Singleton
- Defined in:
- lib/tekeya/configuration.rb
Overview
Parses the configuration file and holds important configuration attributes
Instance Attribute Summary collapse
-
#feed_storage_orm ⇒ Object
Returns the value of attribute feed_storage_orm.
-
#rebat ⇒ Object
readonly
Returns the value of attribute rebat.
-
#rebatdb_host ⇒ Object
Returns the value of attribute rebatdb_host.
-
#rebatdb_port ⇒ Object
Returns the value of attribute rebatdb_port.
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
-
#redis_host ⇒ Object
Returns the value of attribute redis_host.
-
#redis_port ⇒ Object
Returns the value of attribute redis_port.
Instance Method Summary collapse
-
#parse_config_file(path) ⇒ nil
Loads the configuration file.
- #setup_databases ⇒ Object
Instance Attribute Details
#feed_storage_orm ⇒ Object
Returns the value of attribute feed_storage_orm.
10 11 12 |
# File 'lib/tekeya/configuration.rb', line 10 def feed_storage_orm @feed_storage_orm end |
#rebat ⇒ Object (readonly)
Returns the value of attribute rebat.
9 10 11 |
# File 'lib/tekeya/configuration.rb', line 9 def rebat @rebat end |
#rebatdb_host ⇒ Object
Returns the value of attribute rebatdb_host.
10 11 12 |
# File 'lib/tekeya/configuration.rb', line 10 def rebatdb_host @rebatdb_host end |
#rebatdb_port ⇒ Object
Returns the value of attribute rebatdb_port.
10 11 12 |
# File 'lib/tekeya/configuration.rb', line 10 def rebatdb_port @rebatdb_port end |
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
9 10 11 |
# File 'lib/tekeya/configuration.rb', line 9 def redis @redis end |
#redis_host ⇒ Object
Returns the value of attribute redis_host.
10 11 12 |
# File 'lib/tekeya/configuration.rb', line 10 def redis_host @redis_host end |
#redis_port ⇒ Object
Returns the value of attribute redis_port.
10 11 12 |
# File 'lib/tekeya/configuration.rb', line 10 def redis_port @redis_port end |
Instance Method Details
#parse_config_file(path) ⇒ nil
Loads the configuration file
38 39 40 41 42 43 44 45 46 |
# File 'lib/tekeya/configuration.rb', line 38 def parse_config_file(path) return unless File.exists?(path) conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env] conf.each do |key,value| self.send("#{key}=", value) if self.respond_to?("#{key}=") end unless conf.nil? end |
#setup_databases ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tekeya/configuration.rb', line 25 def setup_databases # Setup redis @redis = Redis.new host: @redis_host, port: @redis_port.to_i # Setup resque Resque.redis = @redis # Setup rebatdb @rebat = Rebat.new "#{@rebatdb_host}", "#{@rebatdb_port}", { tracks: 1, joins: 2, blocks: 3 } end |