Today I Learned

TIL, 2017-05-14

  • Integer(hehe) rescue false to ensure if string is an integer.
  • ctime: Created time of a file.
  • Thor mapping a command: map 'n' => :new
  • Dir.glob returns filenames over the pattern supplied. This is how you get filenames.

Ruby Shell commands

Reference

  • Ruby system creates a subprocess, exec replaces the current process.
  • Backticks run a system command in a subshell and return the standard output from that command.
  • $? is a Process::Status object.
  • You can run a non-Ruby command in the shell using a script, and the standard output for that command
> `Date`
> $? => Process::Status object
> $?.to_i => exit code
> $?.pid

This project is maintained by daryllxd