Sha256: 133b1c1919702ba83b51d59c32ae2016cd5da119de802ce32cf66bafe3a45fca
Contents?: true
Size: 315 Bytes
Versions: 4
Compression:
Stored size: 315 Bytes
Contents
class String # Turns a string into a regular expression. # By default it will escape all characters. # Use <tt>false</tt> argument to turn off escaping. # # require 'facet/string/to_re' # # "[".to_re #=> /\[/ # def to_re(esc=true) Regexp.new((esc ? Regexp.escape(self) : self)) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
facets-0.6.3 | lib/facet/string/to_re.rb |
facets-0.7.1 | lib/facet/string/to_re.rb |
facets-0.7.0 | lib/facet/string/to_re.rb |
facets-0.7.2 | lib/facet/string/to_re.rb |