Class: String

Inherits:
Object show all
Includes:
Cannonbol::Operators
Defined in:
lib/cannonbol/cannonbol.rb

Direct Known Subclasses

Cannonbol::MatchString

Instance Method Summary collapse

Methods included from Cannonbol::Operators

#&, #_match?, #capture!, #capture?, included, #insensitive, #matches?, #|

Instance Method Details

#__match?(needle, thread_state = nil) ⇒ Boolean

Returns:

  • (Boolean)


559
560
561
562
563
564
565
566
567
568
# File 'lib/cannonbol/cannonbol.rb', line 559

def __match?(needle, thread_state = nil)

  if thread_state
    needle.pull(thread_state)
  elsif self.length == 0 or
        (!needle.ignore_case and needle.remaining_string[0..self.length-1] == self) or
        (needle.ignore_case and needle.remaining_string[0..self.length-1].upcase == self.upcase)
    [needle.push(self.length)]
  end
end