Skip to content

Instantly share code, notes, and snippets.

@ryancastro
Created August 28, 2013 21:02
Show Gist options
  • Save ryancastro/6371228 to your computer and use it in GitHub Desktop.
Save ryancastro/6371228 to your computer and use it in GitHub Desktop.
Just a little reminder on an interesting way to split command line arguments via commas.
def stuff(things)
things.each do |command|
puts "I am executing this command: #{command.strip}\n"
end
end
stuff(ARGV.join(" ").split(","))
# cmd: test argument1, argument2, argument 3 things, argument 4
# I am executing this command: argument1
# I am executing this command: argument2
# I am executing this command: argument 3 things
# I am executing this command: argument 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment