@@ -528,6 +528,10 @@ def intersect?(other)
528
528
def_delegator :self , :group_by , :group
529
529
def_delegator :self , :group_by , :classify
530
530
531
+ # With a block, yield all the items which are "higher" than `item` (as defined
532
+ # by the set's comparator). Otherwise, return them as a new `SortedSet`.
533
+ #
534
+ # @param item [Object]
531
535
def above ( item , &block )
532
536
if block_given?
533
537
@node . each_greater ( item , @comparator , false , &block )
@@ -536,6 +540,10 @@ def above(item, &block)
536
540
end
537
541
end
538
542
543
+ # With a block, yield all the items which are "higher" than `item` (as defined
544
+ # by the set's comparator). Otherwise, return them as a new `SortedSet`.
545
+ #
546
+ # @param item [Object]
539
547
def below ( item , &block )
540
548
if block_given?
541
549
@node . each_less ( item , @comparator , false , &block )
@@ -544,6 +552,11 @@ def below(item, &block)
544
552
end
545
553
end
546
554
555
+ # With a block, yield all the items which are "higher" or equal to `item`
556
+ # (as determined by the set's comparator). Otherwise, return them as a new
557
+ # `SortedSet`.
558
+ #
559
+ # @param item [Object]
547
560
def from ( item , &block )
548
561
if block_given?
549
562
@node . each_greater ( item , @comparator , true , &block )
@@ -552,6 +565,10 @@ def from(item, &block)
552
565
end
553
566
end
554
567
568
+ # With a block, yield all the items which are "lower" than `item` (as defined
569
+ # by the set's comparator). Otherwise, return them as a new `SortedSet`.
570
+ #
571
+ # @param item [Object]
555
572
def up_to ( item , &block )
556
573
if block_given?
557
574
@node . each_less ( item , @comparator , true , &block )
@@ -560,6 +577,12 @@ def up_to(item, &block)
560
577
end
561
578
end
562
579
580
+ # With a block, yield all the items which are equal or higher than `from` and
581
+ # equal or less than `to` (as determined by the set's comparator). Otherwise,
582
+ # return the specified range of items as a new `SortedSet`.
583
+ #
584
+ # @param from [Object]
585
+ # @param to [Object]
563
586
def between ( from , to , &block )
564
587
if block_given?
565
588
@node . each_between ( from , to , @comparator , &block )
0 commit comments