Skip to content

Instantly share code, notes, and snippets.

@jashmenn
Created September 29, 2008 21:58
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 jashmenn/13686 to your computer and use it in GitHub Desktop.
Save jashmenn/13686 to your computer and use it in GitHub Desktop.
use inflectors from cli
#!/usr/bin/env ruby
# http://gist.github.com/13686
# Nate Murray 2008
require 'activesupport'
#
# Examples:
# * inflect camelize foo_bar
# * echo "foo_bar" | inflect camelize
unless method = ARGV[0]
puts "usage: #{$0} method string"
exit
end
string = nil
if string = ARGV[1]
print string.send(method)
else
while string = $stdin.gets do
print string.send(method)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment