Sha256: 5059fb80140c4339211996255681dc40bcb07c721b8c1fe0e2290f2ae043574e
Contents?: true
Size: 467 Bytes
Versions: 3
Compression:
Stored size: 467 Bytes
Contents
require "attentive/token" module Attentive module Tokens class Regexp < Token attr_reader :regexp def initialize(string, pos) @regexp = ::Regexp.compile("^#{string}") super pos end def ==(other) self.class == other.class && self.regexp == other.regexp end def matches?(cursor) regexp.match(cursor.to_s) end def to_s regexp.inspect[1...-1] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
attentive-0.1.1 | lib/attentive/tokens/regexp.rb |
attentive-0.1.0 | lib/attentive/tokens/regexp.rb |
attentive-0.1.0.beta1 | lib/attentive/tokens/regexp.rb |