class Configue::Criteria
Public Class Methods
new(container, *path)
click to toggle source
# File lib/configue/criteria.rb, line 5 def initialize(container, *path) @container = container @path = path end
Public Instance Methods
[](key)
click to toggle source
# File lib/configue/criteria.rb, line 10 def [](key) self.class.new(@container, *@path, key.to_s) end
exist?()
click to toggle source
# File lib/configue/criteria.rb, line 21 def exist? @path.each.inject(@container) do |h, key| return false unless h.respond_to?(:has_key?) and h.has_key?(key) h[key] end true end
retrieve()
click to toggle source
# File lib/configue/criteria.rb, line 14 def retrieve @path.each.inject(@container) do |h, key| return nil unless h.respond_to?(:has_key?) and h.has_key?(key) h[key] end end