Class: Hanami::Settings::EnvStore Private
- Inherits:
-
Object
- Object
- Hanami::Settings::EnvStore
- Defined in:
- lib/hanami/settings/env_store.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The default store for Hanami::Settings, loading setting values from ‘ENV`.
If your app loads the dotenv gem, then ‘ENV` will also be populated from various `.env` files when you subclass `Hanami::App`.
Constant Summary collapse
- NO_ARG =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Object.new.freeze
Instance Attribute Summary collapse
- #hanami_env ⇒ Object readonly private
- #store ⇒ Object readonly private
Instance Method Summary collapse
- #fetch(name, default_value = NO_ARG, &block) ⇒ Object private
-
#initialize(store: ENV, hanami_env: Hanami.env) ⇒ EnvStore
constructor
private
A new instance of EnvStore.
Constructor Details
#initialize(store: ENV, hanami_env: Hanami.env) ⇒ EnvStore
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of EnvStore.
19 20 21 22 |
# File 'lib/hanami/settings/env_store.rb', line 19 def initialize(store: ENV, hanami_env: Hanami.env) @store = store @hanami_env = hanami_env end |
Instance Attribute Details
#hanami_env ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/hanami/settings/env_store.rb', line 17 def hanami_env @hanami_env end |
#store ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/hanami/settings/env_store.rb', line 17 def store @store end |
Instance Method Details
#fetch(name, default_value = NO_ARG, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 27 28 29 |
# File 'lib/hanami/settings/env_store.rb', line 24 def fetch(name, default_value = NO_ARG, &block) name = name.to_s.upcase args = default_value.eql?(NO_ARG) ? [name] : [name, default_value] store.fetch(*args, &block) end |