Skip to content

Instantly share code, notes, and snippets.

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