Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📚 Workaround rdoc method visibility issue #257

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions lib/net/imap/sequence_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -927,14 +927,18 @@ def each_element # :yields: integer or range or :*
self
end

private def tuple_to_entry((min, max))
private

def tuple_to_entry((min, max))
if min == STAR_INT then :*
elsif max == STAR_INT then min..
elsif min == max then min
else min..max
end
end

public

# Yields each range in #ranges to the block and returns self.
# Returns an enumerator when called without a block.
#
Expand Down Expand Up @@ -1002,7 +1006,9 @@ def find_index(number)
nil
end

private def each_tuple_with_index
private

def each_tuple_with_index
idx_min = 0
@tuples.each do |min, max|
yield min, max, idx_min, (idx_max = idx_min + (max - min))
Expand All @@ -1011,7 +1017,7 @@ def find_index(number)
idx_min
end

private def reverse_each_tuple_with_index
def reverse_each_tuple_with_index
idx_max = -1
@tuples.reverse_each do |min, max|
yield min, max, (idx_min = idx_max - (max - min)), idx_max
Expand All @@ -1020,6 +1026,8 @@ def find_index(number)
idx_max
end

public

# :call-seq: at(index) -> integer or nil
#
# Returns a number from +self+, without modifying the set. Behaves the
Expand Down Expand Up @@ -1086,15 +1094,17 @@ def [](index, length = nil)

alias slice :[]

private def slice_length(start, length)
private

def slice_length(start, length)
start = Integer(start.to_int)
length = Integer(length.to_int)
raise ArgumentError, "length must be positive" unless length.positive?
last = start + length - 1 unless start.negative? && start.abs <= length
slice_range(start..last)
end

private def slice_range(range)
def slice_range(range)
first = range.begin || 0
last = range.end || -1
last -= 1 if range.exclude_end? && range.end && last != STAR_INT
Expand All @@ -1109,6 +1119,8 @@ def [](index, length = nil)
end
end

public

# Returns a frozen SequenceSet with <tt>*</tt> converted to +max+, numbers
# and ranges over +max+ removed, and ranges containing +max+ converted to
# end at +max+.
Expand Down