Sha256: 884671e9814d013e35ff3262c776b6ea94481ae074487991d763ace4ebcc2ce6

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

module ApplicationConfig
  
  module DataStructures
    class NestedHash < Hash
  
      def initialize(hash = {})
        self.update(hash)
      end
      
      def [](key)
        value = fetch(key, nil)
        return ApplicationConfig::DataStructures::AlwaysNullNode.new unless value
        return ApplicationConfig::DataStructures::ValueNode.new(value) unless value.kind_of?(Hash)
        return ApplicationConfig::DataStructures::NestedHash.new(value)
      end
      
      def method_missing(method_name)
        self[method_name.to_s]
      end
    end
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
application_config-0.0.2 lib/application_config/data_structures/nested_hash.rb