class SecretConfig::Config

Attributes

path[R]
registry[R]

Public Class Methods

new(path, registry) click to toggle source
# 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

Public Instance Methods

[](sub_path) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/secret_config/config.rb, line 14
def fetch(sub_path, **options)
  raise(ArgumentError, "sub_path cannot be nil") if sub_path.nil?

  registry.fetch(join_path(sub_path), **options)
end
key?(sub_path) click to toggle source
# 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) click to toggle source
# 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

Private Instance Methods

join_path(sub_path) click to toggle source
# File lib/secret_config/config.rb, line 54
def join_path(sub_path)
  File.join(path, sub_path)
end