Sha256: a2fa86c4542a0ce6cf72290feb051be27281f5c5047dd45197ee18c2cf70d703

Contents?: true

Size: 687 Bytes

Versions: 27

Compression:

Stored size: 687 Bytes

Contents

class Regexp

  # Like #to_re, but following Ruby's formal definitions,
  # only a Regular expression type object will respond to this.
  #
  # Note that to be of much real use this should be defined in core Ruby.
  #
  # CREDIT: Florian Gross

  def to_regexp
    self
  end

  # Simply returns itself. Helpful when converting
  # strings to regular expressions, where regexp
  # might occur as well --in the same vien as using
  # #to_s on symbols. The parameter is actaully a
  # dummy parameter to coincide with String#to_re.
  #
  #   /abc/.to_re  #=> /abc/
  #
  # CREDIT: Trans

  def to_re(esc=false)
    self  # Of course, things really should know how to say "I" ;)
  end

end

Version data entries

27 entries across 26 versions & 3 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/regexp/to_re.rb
facets-3.1.0 lib/core/facets/regexp/to_re.rb
facets-3.0.0 lib/core/facets/regexp/to_re.rb
facets-2.9.3 lib/core/facets/regexp/to_re.rb
facets-2.9.2 src/core/facets/regexp/to_re.rb
facets-2.9.2 lib/core/facets/regexp/to_re.rb
facets-2.9.1 lib/core/facets/regexp/to_re.rb
facets-2.9.0 lib/core/facets/regexp/to_re.rb
facets-2.9.0.pre.2 lib/core/facets/regexp/to_re.rb
facets-2.9.0.pre.1 lib/core/facets/regexp/to_re.rb
facets-2.8.4 lib/core/facets/regexp/to_re.rb
facets-2.8.3 lib/core/facets/regexp/to_re.rb
facets-2.8.2 lib/core/facets/regexp/to_re.rb
facets-2.8.1 lib/core/facets/regexp/to_re.rb
facets-2.8.0 lib/core/facets/regexp/to_re.rb
facets-2.7.0 lib/core/facets/regexp/to_re.rb
facets-2.6.0 lib/core/facets/regexp/to_re.rb
facets-2.4.0 lib/facets/regexp/to_re.rb
facets-2.4.1 lib/facets/regexp/to_re.rb
facets-2.4.4 lib/core/facets/regexp/to_re.rb