Skip to content

Instantly share code, notes, and snippets.

@dvliman
Created April 10, 2014 17:02
Show Gist options
  • Select an option

  • Save dvliman/10402435 to your computer and use it in GitHub Desktop.

Select an option

Save dvliman/10402435 to your computer and use it in GitHub Desktop.

Revisions

  1. dvliman created this gist Apr 10, 2014.
    13 changes: 13 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    $: (Dollar Colon) is basically a shorthand version of $LOAD_PATH. $: contains an array of paths that your script will search through when using require.
    $0 (Dollar Zero) contains the name of the ruby program being run. This is typically the script name.
    $* (Dollar Splat) is basically shorthand for ARGV. $* contains the command line arguments that were passed to the script.
    $? (Dollar Question Mark) returns the exit status of the last child process to finish.
    $$ (Dollar Dollar) returns the process number of the program currently being ran.
    $~ (Dollar Tilde) contains the MatchData from the previous successful pattern match.
    $1, $2, $3, $4 etc represent the content of the previous successful pattern match.
    $& (Dollar Ampersand) contains the matched string from the previous successful pattern match.
    $+ (Dollar Plus) contains the last match from the previous successful pattern match.
    $` (Dollar Backtick) contains the string before the actual matched string of the previous successful pattern match.
    $’ (Dollar Apostrophe) contains the string after the actual matched string of the previous successful pattern match.
    $! (Dollar Bang) contains the Exception that was passed to raise.
    $@ (Dollar At Symbol) contains the backtrace for the last Exception raised.