module Hashie::Extensions::MethodQuery

def indifferent_key?(name)

def indifferent_key?(name)
  name = name.to_s
  key?(name) || key?(name.to_sym)
end

def key_from_query_method(query_method)

def key_from_query_method(query_method)
  query_method.to_s[0..-2]
end

def method_missing(name, *args)

def method_missing(name, *args)
  return super unless args.empty?
  if query_method?(name)
    key = key_from_query_method(name)
    if indifferent_key?(key)
      !!(self[key] || self[key.to_sym])
    else
      super
    end
  else
    super
  end
end

def query_method?(name)

def query_method?(name)
  name.to_s.end_with?('?')
end

def respond_to_missing?(name, include_private = false)

def respond_to_missing?(name, include_private = false)
  if query_method?(name) && indifferent_key?(key_from_query_method(name))
    true
  else
    super
  end
end