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.4.6 lib/sugar-high/regexp.rb
sugar-high-0.4.5.2 lib/sugar-high/regexp.rb
sugar-high-0.4.5 lib/sugar-high/regexp.rb
sugar-high-0.4.4.2 lib/sugar-high/regexp.rb
sugar-high-0.4.4.1 lib/sugar-high/regexp.rb
sugar-high-0.4.4 lib/sugar-high/regexp.rb
sugar-high-0.4.3 lib/sugar-high/regexp.rb
sugar-high-0.4.0 lib/sugar-high/regexp.rb
sugar-high-0.3.7 lib/sugar-high/regexp.rb
sugar-high-0.3.6 lib/sugar-high/regexp.rb
sugar-high-0.3.5 lib/sugar-high/regexp.rb
sugar-high-0.3.4 lib/sugar-high/regexp.rb
sugar-high-0.3.3 lib/sugar-high/regexp.rb
sugar-high-0.3.2 lib/sugar-high/regexp.rb
sugar-high-0.3.1 lib/sugar-high/regexp.rb
sugar-high-0.3.0 lib/sugar-high/regexp.rb
sugar-high-0.2.12 lib/sugar-high/regexp.rb
sugar-high-0.2.11 lib/sugar-high/regexp.rb
sugar-high-0.2.10 lib/sugar-high/regexp.rb
sugar-high-0.2.9 lib/sugar-high/regexp.rb