Chomp
Ruby can be your multitool for all kinds of text-munging tasks. But to use it effectively, you need to understand how Ruby handles line endings and record separators.
Ruby can be your multitool for all kinds of text-munging tasks. But to use it effectively, you need to understand how Ruby handles line endings and record separators.
Ruby has a lot of tools for processing input line-by-line. But when you look a little closer, it turns out that these methods are for more than just lines of text: they generalize to process all sorts of record-oriented input.
Did you know Ruby has a `print` method in addition to `puts`? Did you know it’s for record-oriented output? Do you know how to control the formatting of records in Ruby output streams? Find out all this and more in today’s video!
Ever wondered how async frameworks such as Ruby’s EventMachine or Node.JS work under the hood? Those frameworks are built on a technology known as the Reactor Pattern, and today we’re going to learn about this pattern… with a little help from marshmallows, chocolate, and graham crackers!
In our quest to coordinate asynchronous tasks, we’ve attempted a polling approach. Unfortunately, this strategy has some significant efficiency drawbacks. This time, we’ll apply a technique known as “multiplexing”, to eliminate some unnecessary overhead!
How can we make sure asynchronous work is done efficiently? In ep #2 of a series, we’ll build one of the simplest possible solutions: a polling model.
Ruby’s backtick operator is great for quick-and-dirty output capture, but what do you use when you need more power?
Learn a robust, cross-platform way to throw away unwanted output in Ruby programs.
Learn about Ruby’s Perl-style I/O special variables, and why they exist.
Ruby’s open() call has more tricks up its sleeves than you know!