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.2.8 lib/sugar-high/regexp.rb
sugar-high-0.2.7 lib/sugar-high/regexp.rb
sugar-high-0.2.6 lib/sugar-high/regexp.rb
sugar-high-0.2.5 lib/sugar-high/regexp.rb
sugar-high-0.2.4 lib/sugar-high/regexp.rb
sugar-high-0.2.2 lib/sugar-high/regexp.rb
sugar-high-0.2.1 lib/sugar-high/regexp.rb