summaryrefslogtreecommitdiff
path: root/lib/mpeg/str.rb
blob: cad5a40e73a5a07583ca131f106ee7d5d231017d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module Mpeg
  class Str < Base
    def initialize(string)
      @length = string.size
      @regex = Regexp.new(Regexp.escape(string))
    end

    def call(input)
      return input.consume(@length) if input.matches?(@regex)
      false
    end
  end
end