mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 16:18:01 +00:00
Add Evaluating One-Off Commands as a ruby til.
This commit is contained in:
@@ -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)
|
||||
|
||||
11
ruby/evaluating-one-off-commands.md
Normal file
11
ruby/evaluating-one-off-commands.md
Normal file
@@ -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]
|
||||
```
|
||||
Reference in New Issue
Block a user