class DopCommon::Configuration

Public Class Methods

new(hash) click to toggle source
# File lib/dop_common/configuration.rb, line 11
def initialize(hash)
  @hash = hash
end

Public Instance Methods

lookup(source, key, scope) click to toggle source
# File lib/dop_common/configuration.rb, line 15
def lookup(source, key, scope)
  element = traverse_hash(source)
  if element.has_key?(key)
    element[key]
  else
    raise DopCommon::ConfigurationValueNotFound
  end
rescue => e
  raise DopCommon::ConfigurationValueNotFound
end

Private Instance Methods

traverse_hash(source) click to toggle source
# File lib/dop_common/configuration.rb, line 28
def traverse_hash(source)
  element = @hash
  source.split('/').each do |level|
    element = element[level]
  end
  element
end