Skip to content

Instantly share code, notes, and snippets.

@bguthrie
Created March 27, 2009 17:32
Show Gist options
  • Save bguthrie/86793 to your computer and use it in GitHub Desktop.
Save bguthrie/86793 to your computer and use it in GitHub Desktop.
class String
def to_widget
Widget.new self.gsub(/foo/, "bar")
end
end
String.class_eval do
def to_widget
Widget.new self.gsub(/foo/, "bar")
end
end
module StringExtensions
def to_widget
Widget.new self.gsub(/foo/, "bar")
end
end
String.send :include, StringExtensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment