module Cannonbol::Operators

Public Class Methods

included(base) click to toggle source
# File lib/cannonbol/cannonbol.rb, line 129
def self.included(base)
  base.alias_method :match?, :matches? unless base.method_defined? :match?
  base.alias_method :-@, :insensitive unless base.method_defined? :-@
end

Public Instance Methods

&(pattern) click to toggle source
# File lib/cannonbol/cannonbol.rb, line 113
def &(pattern)
  Concat.new(self, pattern)
end
_match?(needle, *args, &block) click to toggle source
# File lib/cannonbol/cannonbol.rb, line 100
def _match?(needle, *args, &block)
  return if needle.match_failed
  __match?(needle, *args, &block)
end
capture!(opts = {}, &block) click to toggle source
# File lib/cannonbol/cannonbol.rb, line 125
def capture!(opts = {},  &block)
  OnMatch.new(self, opts, &block)
end
capture?(opts = {}, &block) click to toggle source
# File lib/cannonbol/cannonbol.rb, line 121
def capture?(opts = {}, &block)
  OnSuccess.new(self, opts, &block)
end
insensitive() click to toggle source
# File lib/cannonbol/cannonbol.rb, line 117
def insensitive
  CaseSensitiveOff.new(self)
end
matches?(s, opts = {}, &match_block) click to toggle source
# File lib/cannonbol/cannonbol.rb, line 105
def matches?(s, opts = {}, &match_block)
  Needle.new(s).thread(self, opts, &match_block)
end
|(pattern) click to toggle source
# File lib/cannonbol/cannonbol.rb, line 109
def |(pattern)
  Choose.new(self, pattern)
end