Based on a blog post from Steve Yegge…
#ruby
class String
def endswith(arg)
(self =~ /.*#{arg}$/) != nil
end
end
#to test
irb>"extension".endswith("ion")
Based on a blog post from Steve Yegge…
#ruby
class String
def endswith(arg)
(self =~ /.*#{arg}$/) != nil
end
end
#to test
irb>"extension".endswith("ion")
by
Tags: