Class: Heliosphere::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/heliosphere/config.rb

Constant Summary collapse

DEFAULT_CONFIG_FILE =
'config/sunspot.yml'

Instance Attribute Summary collapse

Instance Method Summary collapse

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_fileObject (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

#configObject



15
16
17
# File 'lib/heliosphere/config.rb', line 15

def config
  @config ||= YAML.load(File.read(config_file))
end

#environmentObject



27
28
29
# File 'lib/heliosphere/config.rb', line 27

def environment
  Rails.env.to_s
end

#infoObject



23
24
25
# File 'lib/heliosphere/config.rb', line 23

def info
  "Running in #{environment} environment on port #{port}"
end

#portObject



19
20
21
# File 'lib/heliosphere/config.rb', line 19

def port
  @port ||= config[environment]['solr']['port']
end