Created
September 29, 2008 21:58
-
-
Save jashmenn/13686 to your computer and use it in GitHub Desktop.
use inflectors from cli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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