Skip to content

Commit

Permalink
📚 Workaround rdoc method visibility bug
Browse files Browse the repository at this point in the history
Apparently rdoc doesn't recognize the visibility modifiers when they are
used with method def arguments? 🙁
  • Loading branch information
nevans committed Dec 27, 2023
1 parent ba0f695 commit 9980c69
Showing 1 changed file with 17 additions and 5 deletions.
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

0 comments on commit 9980c69

Please sign in to comment.