Sha256: e1336030759808eec1e5534a5c9b742f4e9c0824e8720a212d0f4d32d9a597d9

Contents?: true

Size: 631 Bytes

Versions: 3

Compression:

Stored size: 631 Bytes

Contents

module Boost
  class Regexp
    
    class << self
      def enable_monkey_patch!
        ::Regexp.__send__(:define_method, :boost!) do |*args|
          flags = args.any? ? args.first : Boost::Regexp::NORMAL
          Boost::Regexp.new(self.source, flags)
        end
      end
    end
    
    def casefold?
      (self.options & IGNORECASE) > 0
    end
    
    def inspect
      base = "/#{source}/"
      base << "m" if options & Boost::Regexp::DOTS_MATCH_NEWLINES > 0
      base << "i" if options & Boost::Regexp::IGNORECASE > 0
      base << "x" if options & Boost::Regexp::IGNORE_WHITESPACE > 0
      base
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-boost-regex-1.1.0 lib/ruby-boost-regex/ruby-parts.rb
ruby-boost-regex-1.0.1 lib/ruby-boost-regex/ruby-parts.rb
ruby-boost-regex-1.0.0 lib/ruby-boost-regex/ruby-parts.rb