Tag: class extensions
-
Simple String Extension in Ruby
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”)