Class: Chamber::ContextResolver
- Inherits:
-
Object
- Object
- Chamber::ContextResolver
- Defined in:
- lib/chamber/context_resolver.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
-
.resolve(options = {}) ⇒ Object
rubocop:enable Metrics/AbcSize, Metrics/LineLength.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ContextResolver
constructor
A new instance of ContextResolver.
-
#resolve ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/LineLength.
Constructor Details
#initialize(options = {}) ⇒ ContextResolver
Returns a new instance of ContextResolver.
14 15 16 |
# File 'lib/chamber/context_resolver.rb', line 14 def initialize( = {}) self. = .dup end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
12 13 14 |
# File 'lib/chamber/context_resolver.rb', line 12 def end |
Class Method Details
.resolve(options = {}) ⇒ Object
rubocop:enable Metrics/AbcSize, Metrics/LineLength
49 50 51 |
# File 'lib/chamber/context_resolver.rb', line 49 def self.resolve( = {}) new().resolve end |
Instance Method Details
#resolve ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/LineLength
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/chamber/context_resolver.rb', line 19 def resolve [:rootpath] ||= Pathname.pwd [:rootpath] = Pathname.new([:rootpath]) [:namespaces] ||= [] [:preset] ||= resolve_preset if %w{rails rails-engine}.include?([:preset]) [:rootpath] = detect_engine_root if [:preset] == 'rails-engine' [:namespaces] = load_rails_default_namespaces([:rootpath]) if [:namespaces] == [] [:basepath] ||= [:rootpath] + 'config' else [:basepath] ||= [:rootpath] end [:encryption_keys] = Keys::Encryption.resolve(filenames: [:encryption_keys], namespaces: [:namespaces], rootpath: [:rootpath]) [:decryption_keys] = Keys::Decryption.resolve(filenames: [:decryption_keys], namespaces: [:namespaces], rootpath: [:rootpath]) [:basepath] = Pathname.new([:basepath]) [:files] ||= [ [:basepath] + 'settings*.yml', [:basepath] + 'settings', ] end |