Ruby Flags & Options
Dynamic language and its reference interpreter.All Ruby pages
- ruby -c file.rb: check Ruby syntax without running the scriptruby -c file.rb checks Ruby syntax without running the script: Syntax OK or the Prism error and exit 1, what it finds and misses, and checking a whole project.
- ruby -e: run Ruby one-liners (with -n, -p, -l, -a for text processing)ruby -e runs Ruby one-liners, and -n, -p, -l, -a turn Ruby into a sed and awk replacement. Arguments after --, BEGIN and END blocks, -i edits and quoting.
- ruby -r and -I: require a library and add to the load path from the command lineruby -r requires a library and -I adds a load path before the script runs. Fix cannot load such file for local code, plus RUBYLIB, RUBYOPT and bundler/setup.
- ruby -w: enable Ruby warnings (and -W0, -W2, $VERBOSE)ruby -w enables verbose Ruby warnings such as unused variables and method redefinitions. Levels -W0, -W1, -W2, $VERBOSE, -W:deprecated categories and RUBYOPT.