class PerseusMatch::Token

Constants

ANY_WC
WC_RE

Attributes

form[R]
wc[R]

Public Class Methods

new(form, wc = nil) click to toggle source
Calls superclass method
   # File lib/perseus_match/token.rb
11 def initialize(form, wc = nil)
12   @form = form.sub(WC_RE, '')
13   @wc   = wc || $1
14 
15   super(@form)
16 end

Public Instance Methods

==(other) click to toggle source
   # File lib/perseus_match/token.rb
27 def ==(other)
28   other.is_a?(self.class) ? form == other.form : form == other
29 end
eql?(other) click to toggle source
   # File lib/perseus_match/token.rb
31 def eql?(other)
32   self == other && wc == other.wc
33 end
inspect() click to toggle source
   # File lib/perseus_match/token.rb
35 def inspect
36   "#{super}/#{wc}"
37 end
Also aliased as: to_s
match?(wcs) click to toggle source
   # File lib/perseus_match/token.rb
18 def match?(wcs)
19   wcs = [*wcs].compact
20   wcs.include?(wc) || wcs.include?(ANY_WC)
21 end
to_s()
Alias for: inspect
unk?() click to toggle source
   # File lib/perseus_match/token.rb
23 def unk?
24   wc == '?'
25 end