Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #771 from kostya/regexp_conv
add Regexp#try_convert, hash
- Loading branch information
Showing
with
14 additions
and 5 deletions.
@@ -0,0 +1,13 @@ | ||
class Regexp | ||
def to_regexp | ||
self | ||
end | ||
|
||
def hash | ||
to_s.hash | ||
end | ||
|
||
def self.try_convert(arg) | ||
Topaz.try_convert_type(arg, Regexp, :to_regexp) | ||
end | ||
end |