Class: Chamber::Keys::Base
- Inherits:
-
Object
- Object
- Chamber::Keys::Base
- Defined in:
- lib/chamber/keys/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#filenames ⇒ Object
Returns the value of attribute filenames.
-
#namespaces ⇒ Object
Returns the value of attribute namespaces.
-
#rootpath ⇒ Object
Returns the value of attribute rootpath.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #resolve ⇒ Object
Constructor Details
Instance Attribute Details
#filenames ⇒ Object
Returns the value of attribute filenames.
12 13 14 |
# File 'lib/chamber/keys/base.rb', line 12 def filenames @filenames end |
#namespaces ⇒ Object
Returns the value of attribute namespaces.
10 11 12 |
# File 'lib/chamber/keys/base.rb', line 10 def namespaces @namespaces end |
#rootpath ⇒ Object
Returns the value of attribute rootpath.
10 11 12 |
# File 'lib/chamber/keys/base.rb', line 10 def rootpath @rootpath end |
Class Method Details
.resolve(*args) ⇒ Object
6 7 8 |
# File 'lib/chamber/keys/base.rb', line 6 def self.resolve(*args) new(*args).resolve end |
Instance Method Details
#resolve ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/chamber/keys/base.rb', line 20 def resolve filenames.each_with_object({}) do |filename, memo| namespace = namespace_from_filename(filename) || '__default' value = key_from_file_contents(filename) || key_from_environment_variable(filename) memo[namespace.downcase.to_sym] = value if value end end |