Class: Heliosphere::Config
- Inherits:
-
Object
- Object
- Heliosphere::Config
- Defined in:
- lib/heliosphere/config.rb
Constant Summary collapse
- DEFAULT_CONFIG_FILE =
'config/sunspot.yml'
Instance Attribute Summary collapse
-
#config_file ⇒ Object
readonly
Returns the value of attribute config_file.
Instance Method Summary collapse
- #config ⇒ Object
- #environment ⇒ Object
- #info ⇒ Object
-
#initialize(config_file = nil) ⇒ Config
constructor
A new instance of Config.
- #port ⇒ Object
Constructor Details
#initialize(config_file = nil) ⇒ Config
Returns a new instance of Config.
11 12 13 |
# File 'lib/heliosphere/config.rb', line 11 def initialize(config_file = nil) @config_file = config_file || DEFAULT_CONFIG_FILE end |
Instance Attribute Details
#config_file ⇒ Object (readonly)
Returns the value of attribute config_file.
9 10 11 |
# File 'lib/heliosphere/config.rb', line 9 def config_file @config_file end |
Instance Method Details
#config ⇒ Object
15 16 17 |
# File 'lib/heliosphere/config.rb', line 15 def config @config ||= YAML.load(File.read(config_file)) end |
#environment ⇒ Object
27 28 29 |
# File 'lib/heliosphere/config.rb', line 27 def environment Rails.env.to_s end |
#info ⇒ Object
23 24 25 |
# File 'lib/heliosphere/config.rb', line 23 def info "Running in #{environment} environment on port #{port}" end |
#port ⇒ Object
19 20 21 |
# File 'lib/heliosphere/config.rb', line 19 def port @port ||= config[environment]['solr']['port'] end |