Sha256: 418461a490cf695b17553eb11ad977f49e88fd2aaf4ea407a427c5f54cf8ca79
Contents?: true
Size: 517 Bytes
Versions: 6
Compression:
Stored size: 517 Bytes
Contents
module Dotaccess class Proxy def initialize(hash) @hash = hash end def method_missing(meth, *args) if @hash.respond_to?(meth) @hash.send(meth, *args) elsif meth =~ %r{\A(.+)=\Z} @hash[$1] = args.first elsif v = (@hash[meth] || @hash[meth.to_s]) v.is_a?(Hash) ? Proxy.new(v) : v else nil end end def [](k) @hash[k] end def ==(o) @hash == o end end def self.[](hash) Proxy.new(hash) end end
Version data entries
6 entries across 6 versions & 1 rubygems