@@ -927,14 +927,18 @@ def each_element # :yields: integer or range or :*
927
927
self
928
928
end
929
929
930
- private def tuple_to_entry ( ( min , max ) )
930
+ private
931
+
932
+ def tuple_to_entry ( ( min , max ) )
931
933
if min == STAR_INT then :*
932
934
elsif max == STAR_INT then min ..
933
935
elsif min == max then min
934
936
else min ..max
935
937
end
936
938
end
937
939
940
+ public
941
+
938
942
# Yields each range in #ranges to the block and returns self.
939
943
# Returns an enumerator when called without a block.
940
944
#
@@ -1002,7 +1006,9 @@ def find_index(number)
1002
1006
nil
1003
1007
end
1004
1008
1005
- private def each_tuple_with_index
1009
+ private
1010
+
1011
+ def each_tuple_with_index
1006
1012
idx_min = 0
1007
1013
@tuples . each do |min , max |
1008
1014
yield min , max , idx_min , ( idx_max = idx_min + ( max - min ) )
@@ -1011,7 +1017,7 @@ def find_index(number)
1011
1017
idx_min
1012
1018
end
1013
1019
1014
- private def reverse_each_tuple_with_index
1020
+ def reverse_each_tuple_with_index
1015
1021
idx_max = -1
1016
1022
@tuples . reverse_each do |min , max |
1017
1023
yield min , max , ( idx_min = idx_max - ( max - min ) ) , idx_max
@@ -1020,6 +1026,8 @@ def find_index(number)
1020
1026
idx_max
1021
1027
end
1022
1028
1029
+ public
1030
+
1023
1031
# :call-seq: at(index) -> integer or nil
1024
1032
#
1025
1033
# Returns a number from +self+, without modifying the set. Behaves the
@@ -1086,15 +1094,17 @@ def [](index, length = nil)
1086
1094
1087
1095
alias slice :[]
1088
1096
1089
- private def slice_length ( start , length )
1097
+ private
1098
+
1099
+ def slice_length ( start , length )
1090
1100
start = Integer ( start . to_int )
1091
1101
length = Integer ( length . to_int )
1092
1102
raise ArgumentError , "length must be positive" unless length . positive?
1093
1103
last = start + length - 1 unless start . negative? && start . abs <= length
1094
1104
slice_range ( start ..last )
1095
1105
end
1096
1106
1097
- private def slice_range ( range )
1107
+ def slice_range ( range )
1098
1108
first = range . begin || 0
1099
1109
last = range . end || -1
1100
1110
last -= 1 if range . exclude_end? && range . end && last != STAR_INT
@@ -1109,6 +1119,8 @@ def [](index, length = nil)
1109
1119
end
1110
1120
end
1111
1121
1122
+ public
1123
+
1112
1124
# Returns a frozen SequenceSet with <tt>*</tt> converted to +max+, numbers
1113
1125
# and ranges over +max+ removed, and ranges containing +max+ converted to
1114
1126
# end at +max+.
0 commit comments