classHashdefwith(key)value=self[key]self[keys.find{|k|k.respond_to?(:include?)&&k.include?(key)}]ifvalue.nil?endendhash={(1..5)=>"One To Five",(6..10)=>"Six To Ten"}putshash.with(4.1123)
classHashalias:with:[]def[](key)value=withkeyifvalue.nil?with(keys.find{|k|k.respond_to?(:include?)&&k.include?(key)})endendendhash={(1..5)=>"One To Five",(6..10)=>"Six To Ten"}putshash[3.222]putshash[9.99]