mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 11:33:06 +08:00
9 lines
175 B
Ruby
9 lines
175 B
Ruby
|
class String
|
||
|
# new to Ruby 2.4, fastest way of matching a string to a regex
|
||
|
unless method_defined? :match?
|
||
|
def match?(regex)
|
||
|
!!(self =~ regex)
|
||
|
end
|
||
|
end
|
||
|
end
|