Class: Almicube::Config
- Inherits:
-
Object
- Object
- Almicube::Config
- Includes:
- ActiveModel::Model
- Defined in:
- lib/almicube/config.rb
Instance Attribute Summary collapse
-
#connection(env = :default) ⇒ Object
Returns the value of attribute connection.
-
#key_format ⇒ Object
Returns the value of attribute key_format.
Class Method Summary collapse
Instance Attribute Details
#connection(env = :default) ⇒ Object
Returns the value of attribute connection.
6 7 8 |
# File 'lib/almicube/config.rb', line 6 def connection @connection end |
#key_format ⇒ Object
Returns the value of attribute key_format.
6 7 8 |
# File 'lib/almicube/config.rb', line 6 def key_format @key_format end |
Class Method Details
.config ⇒ Object
17 18 19 20 21 22 |
# File 'lib/almicube/config.rb', line 17 def config if @instance.nil? && File.exists?(filepath) @instance = self.new YAML.load_file(filepath) end @instance ||= self.new {} end |
.filepath ⇒ Object
13 14 15 |
# File 'lib/almicube/config.rb', line 13 def filepath @filepath ||= File.join(root.to_s, "config", "almicube.yml") end |
.reset ⇒ Object
24 25 26 |
# File 'lib/almicube/config.rb', line 24 def reset @instance = nil end |
.root ⇒ Object
9 10 11 |
# File 'lib/almicube/config.rb', line 9 def root Rails.root if defined? Rails end |