Class: SecretConfig::Config
- Inherits:
-
Object
- Object
- SecretConfig::Config
- Extended by:
- Forwardable
- Defined in:
- lib/secret_config/config.rb
Instance Method Summary collapse
- #[](sub_path) ⇒ Object
- #[]=(sub_path, value) ⇒ Object
- #delete(sub_path) ⇒ Object
- #fetch(sub_path, **options) ⇒ Object
-
#initialize(path, registry) ⇒ Config
constructor
A new instance of Config.
- #key?(sub_path) ⇒ Boolean
- #set(sub_path, value) ⇒ Object
Constructor Details
#initialize(path, registry) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 12 |
# File 'lib/secret_config/config.rb', line 7 def initialize(path, registry) raise(ArgumentError, "path cannot be nil") if path.nil? @path = path @registry = registry end |
Instance Method Details
#[](sub_path) ⇒ Object
20 21 22 23 24 |
# File 'lib/secret_config/config.rb', line 20 def [](sub_path) raise(ArgumentError, "sub_path cannot be nil") if sub_path.nil? registry[join_path(sub_path)] end |
#[]=(sub_path, value) ⇒ Object
26 27 28 29 30 |
# File 'lib/secret_config/config.rb', line 26 def []=(sub_path, value) raise(ArgumentError, "sub_path cannot be nil") if sub_path.nil? registry[join_path(sub_path)] = value end |
#delete(sub_path) ⇒ Object
44 45 46 47 48 |
# File 'lib/secret_config/config.rb', line 44 def delete(sub_path) raise(ArgumentError, "sub_path cannot be nil") if sub_path.nil? registry.delete(join_path(sub_path)) end |
#fetch(sub_path, **options) ⇒ Object
14 15 16 17 18 |
# File 'lib/secret_config/config.rb', line 14 def fetch(sub_path, **) raise(ArgumentError, "sub_path cannot be nil") if sub_path.nil? registry.fetch(join_path(sub_path), **) end |
#key?(sub_path) ⇒ Boolean
32 33 34 35 36 |
# File 'lib/secret_config/config.rb', line 32 def key?(sub_path) raise(ArgumentError, "sub_path cannot be nil") if sub_path.nil? registry.key?(join_path(sub_path)) end |
#set(sub_path, value) ⇒ Object
38 39 40 41 42 |
# File 'lib/secret_config/config.rb', line 38 def set(sub_path, value) raise(ArgumentError, "sub_path cannot be nil") if sub_path.nil? registry.set(join_path(sub_path), value) end |