Sha256: 2a4cf501fdcca781c614d7141ecdc6d16090d13c37797ce58170f5c1033fbc19

Contents?: true

Size: 333 Bytes

Versions: 47

Compression:

Stored size: 333 Bytes

Contents

class String 
  def to_regexp
    /#{Regexp.escape(self)}/
  end
end

class Regexp
  def to_regexp
    self
  end  
end

class MatchData
  def offset_after
    offset(0)[1] +1
  end

  def offset_before
    offset(0)[0] -1    
  end
end

class Array
  def grep_it expr
    return self if !expr
    self.grep(expr.to_regexp)
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
sugar-high-0.6.3 lib/sugar-high/regexp.rb
sugar-high-0.6.2.1 lib/sugar-high/regexp.rb
sugar-high-0.6.1 lib/sugar-high/regexp.rb
sugar-high-0.6.0 lib/sugar-high/regexp.rb
sugar-high-0.5.5 lib/sugar-high/regexp.rb
sugar-high-0.5.4 lib/sugar-high/regexp.rb
sugar-high-0.5.3 lib/sugar-high/regexp.rb
sugar-high-0.5.1 lib/sugar-high/regexp.rb
sugar-high-0.5.0 lib/sugar-high/regexp.rb
sugar-high-0.4.9.5 lib/sugar-high/regexp.rb
sugar-high-0.4.9.3 lib/sugar-high/regexp.rb
sugar-high-0.4.9.2 lib/sugar-high/regexp.rb
sugar-high-0.4.9.1 lib/sugar-high/regexp.rb
sugar-high-0.4.9 lib/sugar-high/regexp.rb
sugar-high-0.4.8 lib/sugar-high/regexp.rb
sugar-high-0.4.7 lib/sugar-high/regexp.rb
sugar-high-0.4.6.4 lib/sugar-high/regexp.rb
sugar-high-0.4.6.3 lib/sugar-high/regexp.rb
sugar-high-0.4.6.2 lib/sugar-high/regexp.rb
sugar-high-0.4.6.1 lib/sugar-high/regexp.rb