module Hashie::Extensions::MethodOverridingWriter
def already_overridden?(name)
def already_overridden?(name) method?("__#{name}") end
def convert_key(key)
def convert_key(key) key.to_s end
def method_missing(name, *args)
def method_missing(name, *args) if args.size == 1 && name.to_s =~ /(.*)=$/ key = Regexp.last_match[1] redefine_method(key) if method?(key) && !already_overridden?(key) return self[convert_key(key)] = args.first end super end
def respond_to_missing?(name, include_private = false)
def respond_to_missing?(name, include_private = false) return true if name.to_s.end_with?('=') super end