module Finix class IndifferentHash < ::Hash def initialize(*args) original_hash = args.slice!(0) || {} self.merge!(original_hash) end def method_missing(method, *args, &block) if self.has_key? "#{method}" value = self["#{method}"] return value.call(*args) if value.respond_to? :call return value end end def count(*args) if self.has_key? 'count' raise Exception.new 'Unsupported block_given exception' if block_given? return self.send :method_missing, :count, *args end super(*args) end end end