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, line 11
def initialize(form, wc = nil)
  @form = form.sub(WC_RE, '')
  @wc   = wc || $1

  super(@form)
end

Public Instance Methods

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