class CHECKING::YOU::SweetSweet♥Magic::SpeedyCat

Represent a container for multiple matching byte sequences along with a priority value to use when there are multiple matches for a stream, in which case the highest `weight` wins. Note: Array methods will return `Array` instead of `WeightedAction` since bugs.ruby-lang.org/issues/6087

Public Instance Methods

=~(otra, offset: 0) click to toggle source

Match all-or-none member Sequences against some given bytes. The `offset` parameter allows senders to provide a smaller-than-whole slice of input without invalidating our members' `boundary`-from-start-of-stream.

# File lib/checking-you-out/sweet_sweet_love_magic.rb, line 59
def =~(otra, offset: 0)
  self.each { |sequence_cat|
    return false unless sequence_cat =~ otra.slice(sequence_cat.min - offset, sequence_cat.size)
  }
  return true
end
max() click to toggle source
# File lib/checking-you-out/sweet_sweet_love_magic.rb, line 52
def max;     self.map(&:max).max; end
min() click to toggle source

Forward `Range`-like methods to our member Sequences.

# File lib/checking-you-out/sweet_sweet_love_magic.rb, line 51
def min;     self.map(&:min).min; end
minmax() click to toggle source
# File lib/checking-you-out/sweet_sweet_love_magic.rb, line 53
def minmax; [self.min, self.max]; end
size() click to toggle source
# File lib/checking-you-out/sweet_sweet_love_magic.rb, line 54
def size;    self.max - self.min; end