Skip to content

Instantly share code, notes, and snippets.

@joho
Created February 16, 2009 23:55
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 joho/65468 to your computer and use it in GitHub Desktop.
Save joho/65468 to your computer and use it in GitHub Desktop.
Proper english method calls
class Object
def method_missing(meth, *args, &block)
proper_english = { 'colour' => 'color',
'pluralise' => 'pluralize',
'metre' => 'meter' }
american_method_name = proper_english[meth.to_s]
if american_method_name
puts "** Using the proper english to call method #{american_method_name}"
return self.send(american_method_name, *args, &block)
end
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment