@@ -346,102 +346,6 @@ def __update(h)
346346 h . each_key { |k | self [ k ] = h [ k ] }
347347 self
348348 end
349-
350- ##
351- # call-seq:
352- # hash < other -> true or false
353- #
354- # Returns <code>true</code> if <i>hash</i> is subset of
355- # <i>other</i>.
356- #
357- # h1 = {a:1, b:2}
358- # h2 = {a:1, b:2, c:3}
359- # h1 < h2 #=> true
360- # h2 < h1 #=> false
361- # h1 < h1 #=> false
362- #
363- def <( hash )
364- begin
365- hash = hash . to_hash
366- rescue NoMethodError
367- raise TypeError , "can't convert #{ hash . class } to Hash"
368- end
369- size < hash . size and all? { |key , val |
370- hash . key? ( key ) and hash [ key ] == val
371- }
372- end
373-
374- ##
375- # call-seq:
376- # hash <= other -> true or false
377- #
378- # Returns <code>true</code> if <i>hash</i> is subset of
379- # <i>other</i> or equals to <i>other</i>.
380- #
381- # h1 = {a:1, b:2}
382- # h2 = {a:1, b:2, c:3}
383- # h1 <= h2 #=> true
384- # h2 <= h1 #=> false
385- # h1 <= h1 #=> true
386- #
387- def <=( hash )
388- begin
389- hash = hash . to_hash
390- rescue NoMethodError
391- raise TypeError , "can't convert #{ hash . class } to Hash"
392- end
393- size <= hash . size and all? { |key , val |
394- hash . key? ( key ) and hash [ key ] == val
395- }
396- end
397-
398- ##
399- # call-seq:
400- # hash > other -> true or false
401- #
402- # Returns <code>true</code> if <i>other</i> is subset of
403- # <i>hash</i>.
404- #
405- # h1 = {a:1, b:2}
406- # h2 = {a:1, b:2, c:3}
407- # h1 > h2 #=> false
408- # h2 > h1 #=> true
409- # h1 > h1 #=> false
410- #
411- def >( hash )
412- begin
413- hash = hash . to_hash
414- rescue NoMethodError
415- raise TypeError , "can't convert #{ hash . class } to Hash"
416- end
417- size > hash . size and hash . all? { |key , val |
418- key? ( key ) and self [ key ] == val
419- }
420- end
421-
422- ##
423- # call-seq:
424- # hash >= other -> true or false
425- #
426- # Returns <code>true</code> if <i>other</i> is subset of
427- # <i>hash</i> or equals to <i>hash</i>.
428- #
429- # h1 = {a:1, b:2}
430- # h2 = {a:1, b:2, c:3}
431- # h1 >= h2 #=> false
432- # h2 >= h1 #=> true
433- # h1 >= h1 #=> true
434- #
435- def >=( hash )
436- begin
437- hash = hash . to_hash
438- rescue NoMethodError
439- raise TypeError , "can't convert #{ hash . class } to Hash"
440- end
441- size >= hash . size and hash . all? { |key , val |
442- key? ( key ) and self [ key ] == val
443- }
444- end
445349end
446350
447351##
0 commit comments