Skip to content

Instantly share code, notes, and snippets.

@taichiman
Last active November 17, 2015 11:26
Show Gist options
  • Save taichiman/a5251824050989c6bec7 to your computer and use it in GitHub Desktop.
Save taichiman/a5251824050989c6bec7 to your computer and use it in GitHub Desktop.
cheetsheets
@taichiman
Copy link
Author

ruby MAIN FLOW:

def do_at_exit(str1)
at_exit { print str1 }
end
at_exit { puts "cruel world" }
do_at_exit("goodbye ")
exit

@taichiman
Copy link
Author

File:

Dir

entries

foreach dir

FileUtils

copy_entry

copy_file

copy_stream

cp, copy

@taichiman
Copy link
Author

CLI Options:

http://ruby-doc.org/stdlib-2.2.0/libdoc/getoptlong/rdoc/GetoptLong.html
The GetoptLong class allows you to parse command line options similarly to the GNU getopt_long() C library call.

http://ruby-doc.org/stdlib-2.2.0/libdoc/optparse/rdoc/OptParse.html
OptionParser is a class for command-line option analysis. It is much more advanced, yet also easier to use, than GetoptLong, and is a more Ruby-oriented solution.

https://github.com/leejarvis/slop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment