Sha256: aee6dac7990153564d363722ed4cf511ef07d9343f73513f9e74c856df92ac6c
Contents?: true
Size: 824 Bytes
Versions: 20
Compression:
Stored size: 824 Bytes
Contents
module RestCore; end class RestCore::Clash Empty = Hash.new(&(l = lambda{|_,_|Hash.new(&l).freeze})).freeze attr_accessor :data def initialize data self.data = data end def [] k if data.key?(k) convert(data[k]) else Empty end end def == rhs if rhs.kind_of?(RestCore::Clash) data == rhs.data else data == rhs end end private def convert value case value when Hash RestCore::Clash.new(value) when Array value.map{ |ele| convert(ele) } else value end end def respond_to_missing? msg, include_private=false data.respond_to?(msg, include_private) end def method_missing msg, *args, &block if data.respond_to?(msg) data.public_send(msg, *args, &block) else super end end end
Version data entries
20 entries across 20 versions & 1 rubygems