Category: Ruby

  • Pry Plugins

    Crafting Your First Pry Plugin

    When I was first introduced to the pry gem and the alternative Ruby CLI / REPL experience it provides, I have to admit, I didn't get it. I didn't understand why pry was a better option than irb or more typically for me, rails console. Sure, Pry's built-in commands like...
    tco_method

    Introducing the tco_method gem

    Earlier this week I published a gem intended to help simplify the process of compiling Ruby code with tail call optimization enabled in MRI Ruby. The gem, tco_method, builds on my recent research into the internals of Ruby's implementation of tail call optimization and the ideas presented in Nithin Bekal's...
  • I'm going to continue never washing this cheek again

    Eager Boolean Operators: A Pattern to Continue Never Using

    In relaying the story of eager Boolean operators, it is best to begin with their more ubiquitous siblings, short-circuiting logical Boolean operators. This is perhaps best achieved with an example: true || Seriously(this(is(valid(Ruby!)))) # => true false && 0/0 # => false In Ruby, and many other common programming languages,1...
    Meditation Cairn Atop Rippling Waters

    On the Road From Ruby Journeyman to Ruby Master

    Mind-blowingly awful are really the only words that come to mind to describe my first bunch of Ruby scripts.1 Sure, this is probably unfair and over-critical given that Ruby, algorithms, and the whole shebang were all new to me at the time, but damn. There are so many decisions I...
  • Module Factory Assembly Line

    Dependency and Load-Order Management Using the Module Factory Pattern

    At last year's RubyConf in San Diego, Craig Buchek gave a presentation entitled Ruby Idioms You're Not Using Yet focusing on some of Ruby's under-utilized and emerging idioms. In this post we'll discuss one of those idioms, an idiom Craig appropriately calls Module Factory. In particular, we'll explore the using...
    Tail Call Optimization in Ruby: Deep Dive

    Tail Call Optimization in Ruby: Deep Dive

    In my last post, I began an exploration of tail call optimization in Ruby with some background on tail call optimization and its little known existence and usage in Ruby. In this post, we'll continue that exploration at a much lower level, moving out of the Ruby layer and descending...
  • Recursive Guinea Pigs

    Tail Call Optimization in Ruby: Background

    Back in November, care of /r/ruby, I came across a blog post by Nithin Bekal, Tail Call Optimization in Ruby, demonstrating Ruby's built-in support for tail call optimization and I have to admit, my mind was a little blown. It's not that I have a specific need for tail call...