Skip to content

Instantly share code, notes, and snippets.

@lachie
Forked from slowjud/string.rb
Created February 26, 2009 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lachie/70596 to your computer and use it in GitHub Desktop.
Save lachie/70596 to your computer and use it in GitHub Desktop.
class String
class TextHelperSingleton
def self.instance; @instance ||= new end
include ActionView::Helpers::TextHelper
end
def method_missing(method, *args, &block)
if TextHelperSingleton.instance.respond_to?(method)
self.class.send(:define_method, method, &block) do
TextHelperSingleton.instance.send(method, self, *args, &block)
end
send(method, *args, &block)
else
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment