Module: LittleFinger::Configuration
- Defined in:
- lib/little_finger/configuration.rb
Constant Summary collapse
- @@conf =
nil
Class Method Summary collapse
- .configuration ⇒ Object
- .configure_with(environment_name, yaml_file = nil) ⇒ Object
- .environment ⇒ Object
Class Method Details
.configuration ⇒ Object
12 13 14 15 |
# File 'lib/little_finger/configuration.rb', line 12 def self.configuration self.configure_with(self.environment) if @@conf.nil? @@conf end |
.configure_with(environment_name, yaml_file = nil) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/little_finger/configuration.rb', line 5 def self.configure_with(environment_name, yaml_file = nil) @@yaml_file = yaml_file.nil? ? "config/little_finger.yml" : yaml_file @@all_conf = Hashie::Mash.new(YAML.load_file(@@yaml_file) ) @@conf = @@all_conf[environment_name] self end |
.environment ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/little_finger/configuration.rb', line 17 def self.environment val = ENV["RAILS_ENV"] || ENV["RACK_ENV"] val = if val.present? val.to_sym else if defined?(Rails) Rails.env else raise "No environment can be found for configuration!" end end end |