class Cased::Sensitive::String

Attributes

label[R]
string[R]

Public Class Methods

new(string, label: nil) click to toggle source
Calls superclass method
# File lib/cased/sensitive/string.rb, line 11
def initialize(string, label: nil)
  super(string)
  @label = label
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/cased/sensitive/string.rb, line 37
def ==(other)
  super(other) &&
    @label == other.label
end
matches(regex) click to toggle source
# File lib/cased/sensitive/string.rb, line 25
def matches(regex)
  offset = 0
  matches = []

  while (result = match(regex, offset))
    matches.push(result)
    offset = result.end(0)
  end

  matches
end
range(key:) click to toggle source
# File lib/cased/sensitive/string.rb, line 16
def range(key:)
  Cased::Sensitive::Range.new(
    label: label,
    key: key,
    begin_offset: 0,
    end_offset: length,
  )
end