class StringSplitter::Split

Attributes

captures[R]
count[R]
index[R]
lhs[R]
pos[R]
position[R]
rhs[RW]
separator[R]

Public Class Methods

new(captures:, lhs:, rhs:, separator:) click to toggle source
# File lib/string_splitter/split.rb, line 26
def initialize(captures:, lhs:, rhs:, separator:)
  @captures = captures
  @lhs = lhs
  @rhs = rhs
  @separator = separator
end

Public Instance Methods

rindex() click to toggle source

0-based index relative to the end of the array, e.g. for 5 items:

index | rindex
------|-------
  0   |   4
  1   |   3
  2   |   2
  3   |   1
  4   |   0
# File lib/string_splitter/split.rb, line 42
def rindex
  @count - @position
end
rpos()
Alias for: rposition
rposition() click to toggle source

1-based position relative to the end of the array, e.g. for 5 items:

 position | rposition
----------|----------
    1     |    5
    2     |    4
    3     |    3
    4     |    2
    5     |    1
# File lib/string_splitter/split.rb, line 55
def rposition
  @count + 1 - @position
end
Also aliased as: rpos