class CHECKING::YOU::MagicWithoutTears
Hash subclass to index our find-by-content byte-sequences. Sequences define a Range of the byte boundaries where they might be found in a hypothetical file/stream. Store them in nested Hashes, e.g. {offset.min => {offset.max => {CatSequence[SequenceCat, …] => CHECKING::YOU::OUT
}}}
Public Instance Methods
bury(*args)
click to toggle source
Automatically nest additional MWT Hashes when storing Sequences. Rejected upstream, so we need to roll our own: bugs.ruby-lang.org/issues/11747
# File lib/checking-you-out/sweet_sweet_love_magic.rb, line 18 def bury(*args) case args.count when 0, 1 then raise ArgumentError.new("Can't `bury` fewer than two arguments.") when 2 then self[args.first] = args.last else (self[args.shift] ||= self.class.new).bury(*args) end self end
new()
click to toggle source
Calls superclass method
# File lib/checking-you-out/sweet_sweet_love_magic.rb, line 12 def new() super { |h,k| h[k] = self.class.new(&h.default_proc) } end