Sha256: 1a62122e186e83b813203e3652c8eb86fc1239f4f80ca79071feea1686c8e5d8

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

class Regexp
  
  # 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.
  #
  #   require 'facet/regexp/to_re'
  #
  #   /abc/.to_re  #=> /abc/
  #
  def to_re( esc=false )
    self  # Of course, things really should know how to say "I" ;)
  end
  
  # Like #to_re, but following Ruby's formal definitions,
  # only a Regular expression like object will respond to this.
  #
  # Note: To be of much real use this should be defined in core Ruby.
  def to_regexp
    self
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.6.3 lib/facet/regexp/to_re.rb