Skip to content
Permalink
Browse files

Merge pull request #773 from kachick/implement-regexp-tilde,eql

Implement Regexp#~, Regexp#eql?
  • Loading branch information
alex committed Jun 26, 2013
2 parents 961efda + 390a22c commit 2add178fe04a8a0e9b8bf894b93f8c48841da1b9
@@ -7,6 +7,10 @@ def hash
to_s.hash
end

def ~
self =~ $_
end

def self.try_convert(arg)
Topaz.try_convert_type(arg, Regexp, :to_regexp)
end
@@ -1,5 +1,2 @@
fails:Regexp#eql? is true if self and other have the same pattern
fails:Regexp#eql? is true if self and other have the same character set code
fails:Regexp#eql? is true if other has the same #casefold? values
fails:Regexp#eql? is true if self does not specify /n option and other does
fails:Regexp#eql? is true if self specifies /n option and other does not
@@ -1,5 +1,4 @@
fails:Regexp#match resets $~ if passed nil
fails:Regexp#match when passed a block yields the MatchData
fails:Regexp#match when passed a block returns the block result
fails:Regexp#~ matches against the contents of $_
fails:Regexp#match uses the start as a character offset
@@ -188,6 +188,7 @@ def method_to_s(self, space):
missing_flags += c
return space.newstr_fromstr("(?%s-%s:%s)" % (flags, missing_flags, self.source))

@classdef.method("eql?")
@classdef.method("==")
def method_equal(self, space, w_other):
if self is w_other:

0 comments on commit 2add178

Please sign in to comment.
You can’t perform that action at this time.