The book heavily leans on examples and exercises to help you get comfortable with using Ruby from the command line. It is recommended that you manually type each example and experiment with them.
You should be comfortable with programming basics and have prior experience working with Ruby. You should know concepts like blocks, be familiar with string/array/hash/enumerable methods, regular expressions etc. You should also have prior experience working with command line and bash shell and be familiar with concepts like file redirection, command pipeline and so on.
This Ruby one-liners cookbook is incredible. Pretty mind boggling all the stuff you can do.
For a preview of the book, see sample chapters at https://github.com/learnbyexample/learn_ruby_oneliners/blob/master/sample_chapters/ruby_oneliners_sample.pdf
Visit https://github.com/learnbyexample/learn_ruby_oneliners for code snippets and exercise files. The repo also has solutions for exercises.
You'll get PDF and EPUB versions of the book.