lib/csl/compatibility.rb in csl-1.0.0 vs lib/csl/compatibility.rb in csl-1.0.1
- old
+ new
@@ -6,21 +6,10 @@
return unless other.kind_of?(Symbol)
to_s <=> other.to_s
end
def match(pattern)
- str = to_s
-
- case pattern
- when Regexp
- match_data = pattern.search_region(str, 0, str.bytesize, true)
- Regexp.last_match = match_data
- return match_data.full[0] if match_data
- when String
- raise TypeError, "type mismatch: String given"
- else
- pattern =~ str
- end
+ to_s.match(pattern)
end
alias =~ match
end unless Symbol.is_a?(Comparable)