Sha256: 2a4b47b70f39f0dfe740b8e7bae9f7705a88dc152ec36bd99f79f90962c4cc7d
Contents?: true
Size: 469 Bytes
Versions: 1
Compression:
Stored size: 469 Bytes
Contents
require 'hashie' class Musterb::HashExtractor < Musterb::Extractor attr_reader :parent, :value def initialize(value, parent) @value = to_string_access(value) @parent = parent end def [](symbol) if @value.has_key? symbol @value[symbol] else @parent[symbol] end end private def to_string_access(hash) hash.dup.tap do |hash| hash.extend Hashie::HashExtensions hash.hashie_stringify_keys! end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
musterb-1.0.0 | lib/musterb/hash_extractor.rb |