Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building command line applications in Ruby

Building command line applications in Ruby

Presented at Women Who Code, Rails install fest.

http://www.meetup.com/Women-Who-Code-London/events/225878453/

Robbie Clutton

November 05, 2015
Tweet

More Decks by Robbie Clutton

Other Decks in Programming

Transcript

  1. Why? We can build small, stand alone applications without worrying

    about introducing too much all at the same time.
  2. Reading from the command line We can read numbers from

    the command line, and put them into our application to do addition, subtraction and multiplication upon.
  3. ARGV “ARGF is a stream designed for use in scripts

    that process files given as command-line arguments or passed in via STDIN. The arguments passed to your script are stored in the ARGV Array, one argument per element. ARGF assumes that any arguments that aren't filenames have been removed from ARGV.”
  4. Add all the numbers sum = 0 ARGV.each do |arg|

    sum += arg.to_i end puts sum