class Smplkit::Config::LiveConfigProxy
rebuilds the snapshot from the underlying client.#[] return the resolved value at the time of access; #refresh
Backed by the most-recent resolved Hash for a config key. #get /
A live, dot-accessible view over a resolved configuration.
def [](item_key)
def [](item_key) get(item_key) end
def get(item_key, default = nil)
def get(item_key, default = nil) return @snapshot if item_key.nil? keys = item_key.to_s.split(".") keys.reduce(@snapshot) do |scope, k| break default if scope.nil? scope.is_a?(Hash) ? scope[k] : default end || default end
def initialize(client, key)
def initialize(client, key) @client = client @key = key @snapshot = client._resolve_now(key) end
def refresh
def refresh @snapshot = @client._resolve_now(@key) self end
def to_h
def to_h @snapshot.dup end