Sha256: 7c6de9eaff367e1df50248116bcddc5d0e82c0f3a0a0834d41fc4b878303b6b8
Contents?: true
Size: 1.18 KB
Versions: 7
Compression:
Stored size: 1.18 KB
Contents
Ru (version <%= version %>) Ruby in your shell! Ru brings Ruby's expressiveness, cleanliness, and readability to the command line. It lets you avoid looking up pesky options in man pages and Googling how to write a transformation in bash that would take you approximately 1s to write in Ruby. For example, to center a file's lines, use String#center: ru 'map(:center, 80)' myfile To sum the lines of a list of integers: ru 'map(:to_i).sum' myfile Ru reads from stdin: $ printf "2\n3" | ru 'map(:to_i).sum' 5 $ cat myfile | ru 'map(:to_i).sum' 5 Or from file(s): $ ru 'map(:to_i).sum' myfile 5 $ ru 'map(:to_i).sum' myfile myfile 10 You can also run Ruby code without any input by prepending a `! `: $ ru '! 2 + 3' 5 The code argument is run as if it has `$stdin.each_line.map(&:chomp).` prepended to it. The result is converted to a string and printed. So, if you run `ru 'map(:to_i).sum'`, you can think of it as `puts $stdin.each_line.map(&:chomp).map(:to_i).sum`. In addition to the methods provided by Ruby Core and Active Support, Ru provides other methods for performing transformations, like `each_line`, `files`, and `grep`. To read more, see the README: https://github.com/tombenner/ru
Version data entries
7 entries across 7 versions & 2 rubygems
Version | Path |
---|---|
ru2-2.3.1 | doc/help.erb |
ru2-2.3.0 | doc/help.erb |
ru2-2.2.0 | doc/help.erb |
ru2-2.1.5 | doc/help.erb |
ru2-2.1.4 | doc/help.erb |
ru-0.1.4 | doc/help.erb |
ru-0.1.3 | doc/help.erb |