Created
March 27, 2009 17:32
-
-
Save bguthrie/86793 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def to_widget | |
Widget.new self.gsub(/foo/, "bar") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.class_eval do | |
def to_widget | |
Widget.new self.gsub(/foo/, "bar") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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