Sha256: 69d74a93ab416ce33ac26d573235e0456a1f1896b117fc5aa958d5f4edfc300d
Contents?: true
Size: 679 Bytes
Versions: 10
Compression:
Stored size: 679 Bytes
Contents
module Macmillan module Utils module Settings class Lookup def initialize(backends) @backends = backends end def lookup(key) value = nil @backends.each do |backend| break if value result = backend.get(key) value = result.value unless result.is_a?(KeyNotFound) end fail KeyNotFoundError.new("Cannot find a settings value for #{key}") unless value value end # Backwards compatibility: in the past this has been used like a Hash alias_method :[], :lookup alias_method :fetch, :lookup end end end end
Version data entries
10 entries across 10 versions & 1 rubygems