Skip to content

Instantly share code, notes, and snippets.

@jashmenn

jashmenn/gist:13686

Created Sep 29, 2008
Embed
What would you like to do?
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