From 34f39e221790ba243e430e71fcdf27a1f9f54fe0 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Tue, 12 May 2015 08:49:11 -0500 Subject: [PATCH] Add Evaluating One-Off Commands as a ruby til. --- README.md | 1 + ruby/evaluating-one-off-commands.md | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 ruby/evaluating-one-off-commands.md diff --git a/README.md b/README.md index 7686456..07e5c58 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Are They All True?](ruby/are-they-all-true.md) - [Create an Array of Stringed Numbers](ruby/create-an-array-of-stringed-numbers.md) - [Destructuring Arrays In Blocks](ruby/destructuring-arrays-in-blocks.md) +- [Evaluating One-Off Commands](ruby/evaluating-one-off-commands.md) - [Finding The Source of Ruby Methods](ruby/finding-the-source-of-ruby-methods.md) - [Limit Split](ruby/limit-split.md) - [Parallel Bundle Install](ruby/parallel-bundle-install.md) diff --git a/ruby/evaluating-one-off-commands.md b/ruby/evaluating-one-off-commands.md new file mode 100644 index 0000000..7f2f1b5 --- /dev/null +++ b/ruby/evaluating-one-off-commands.md @@ -0,0 +1,11 @@ +# Evaluating One-Off Commands + +When I need to quickly test something out in Ruby, I will often reach for +`irb`. There is an even quicker way to send a line of code to ruby for +evaluation. Use the `ruby` binary with the `-e` flag followed by your line +of ruby. For instance, + +``` +$ ruby -e 'puts Class.ancestors' +[Class, Module, Object, Kernel, BasicObject] +```