Method: List::Matcher::CharClass#initialize

Defined in:
lib/list_matcher.rb

#initialize(engine, children) ⇒ CharClass

Returns a new instance of CharClass.



645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/list_matcher.rb', line 645

def initialize(engine, children)
  super(engine, nil)
  if engine.case_insensitive
    if ( CI_WORD_CHARS - children ).empty?
      self.word = true
      self.num = false
      children -= CI_WORD_CHARS
    end
  elsif ( WORD_CHARS - children ).empty?
    self.word = true
    self.num = false
    children -= WORD_CHARS
  end
  if num.nil? && ( NUM_CHARS - children ).empty?
    self.num = true
    children -= NUM_CHARS
  end
  if ( SPACE_CHARS - children ).empty?
    self.space = true
    children -= SPACE_CHARS
  end
  @children = children
end