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
Instance Method Summary collapse
-
#initialize(**args) ⇒ ContextResolver
constructor
A new instance of ContextResolver.
-
#resolve ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize, Layout/LineLength, Lint/SelfAssignment.
Constructor Details
#initialize(**args) ⇒ ContextResolver
Returns a new instance of ContextResolver.
17 18 19 |
# File 'lib/chamber/context_resolver.rb', line 17 def initialize(**args) self. = args end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
11 12 13 |
# File 'lib/chamber/context_resolver.rb', line 11 def @options end |
Class Method Details
.resolve(**args) ⇒ Object
13 14 15 |
# File 'lib/chamber/context_resolver.rb', line 13 def self.resolve(**args) new(**args).resolve end |
Instance Method Details
#resolve ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize, Layout/LineLength, Lint/SelfAssignment
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 47 48 49 50 51 52 |
# File 'lib/chamber/context_resolver.rb', line 22 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 [:namespaces] = resolve_namespaces([:namespaces]) [: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', ] [:signature_name] = [:signature_name] end |