Robert is a voracious reader, Ruby aficionado, and other big words.

Robert's articles

  1. More Common Trip-ups for New Rubyists

    Summary

    • self is always the current object.
    • Rather than declaring instance variables in constructors as in static languages, it’s sometimes better to take advantage of lazy initialization methods.
    • #instance_eval runs a block or string in the context of an instance, including instances of Class
    • Use #class_eval to define methods for all instances of a class.
    • There is no difference between compile-time and run-time code in Ruby.
    • In Ruby, a constant is any word that begins with a capital letter.
    • Constants are mostly used for class and module names, never as enums like in other languages.
    • The scope-resolution operator :: is used to specify constants
    • Put :: at the front of a constant to specify a root level constant.
    • Private methods are methods that cannot have an explicit receiver, including self.
    • Objects receive messages to call methods.
    • The . operator is shorthand for #send to send a message to an object
    • #method_missing can intervene when an object does not know how to respond to a message.
    • It’s important to define #respond_to_missing when defining #method_missing.
    • An eigenclass or singleton class is a unique class an object is linked to.
    • The class < < syntax can be used to open an object’s eigenclass, including a class object.
    • Class methods cannot be private, but eigenclass methods defined on classes can.
    • Methods like attr_accessor can be defined as class-level methods of classes or instance-level methods of Class.
  2. Common Trip-ups for New Rubyists, Part I

    Once internalized, Ruby is a fairly straightforward language. Until that happens, however, many potential converts are turned off by some of its more unusual aspects. This series hopes to clear up some of the confusion that newcomers face when learning Ruby. There will be an attempt to adhere to the RDoc notation for describing methods: […]

  3. GUI Applications with Shoes

    If you’ve been coding in Ruby for any length of time, you’ve probably at least heard of Shoes. Shoes is a DSL / GUI toolkit originally developed by the famed _why The Lucky Stiff. It’s also the basis for the Hackety Hack program that helps users learn Ruby and GUI programming. You can find the […]

  4. Parsing with the Parslet Gem

    Parsing is…complicated. And yet, we wouldn’t have many facets of the modern world without it. Our ability to get behavior out of a computer is limited by the expressiveness of our programming languages. And the programming languages available to us are limited by our parsing techniques. The construction of a programming language consists of at […]

  5. Forking and IPC in Ruby, Part I

    I like to think of forking as the underdog of the concurrency world. In fact, at this point, many programmers have probably never even heard of it. The term “multithreaded” has almost become synonymous with “concurrent” or “parallel.” The fork() system call creates a “copy” of the current process. For our purposes in Ruby, it […]

  6. A Guide to Ruby Collections IV: Tips and Tricks

    This entry is part 4 of 4 in the series A Guide to Ruby Collections

    This entry is part 4 of 4 in the series A Guide to Ruby Collections This is the last article in the Guide to Ruby Collections series. I want to finish up by providing some miscellaneous tips that you will hopefully find helpful during your Ruby adventures. More Detailed Array Creation In the introduction to […]

  7. A Guide to Ruby Collections, Part I: Arrays

    This entry is part 1 of 4 in the series A Guide to Ruby Collections

    This entry is part 1 of 4 in the series A Guide to Ruby Collections Programming consists largely of sorting and searching. In an older language like C, you might be expected to write your own data structures and algorithms for these tasks. However, with Ruby these constructs have been abstracted away in favor of […]

  8. A Tour Through Random Ruby

    This article covers various ways that you can generate random (usually pseudo-random) information with Ruby. Random information can be useful for a variety of things, in particular testing, content generation, and security. I used Ruby 2.0.0, but 1.9 should produce the same results. Kernel#rand and Random In the past, a random range of numbers might […]

  9. Winewatcher – Desktop Notifications in Ruby

    For the uninitiated, Wine (Wine Is Not an Emulator) is “a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, Mac OSX, and BSD.” It’s called “Not an Emulator” for a reason – instead of simulating an entire operating system in a virtual machine, it translates API calls in […]

  10. Seeking Lovecraft, Part 1: An introduction to NLP and the Treat Gem

    We just started Unknowable Horror LLC. Our plan is sift through the vast ocean of bytes that is the internet in order to find the next H.P. Lovecraft so that we can make a fortune selling masterful cosmic horror. Alternatively, if we can’t find the next H.P. Lovecraft, we might just write our own stories […]