banisterfiend

Updating A C Extension For Ruby 1.9.1


~5 years ago by banisterfiend on Like Dream of Banister Fiend.
One of my favourite C extensions for Ruby 1.8.6 is Mixology. Mixology makes it possible to dynamically mix and unmix modules from inheritance chains and...

wtf?! Infinite Ranges in Ruby


over 4 years ago by banisterfiend on Like Dream of Banister Fiend.
First let’s define an Infinity constant (since Ruby does not come with one): Inf = 1.0 / 0.0 Now let’s see if we can create a Range Object with it...

The DevIL Image Library For Ruby


over 4 years ago by banisterfiend on Like Dream of Banister Fiend.
The DevIL library supports the loading and saving of images in almost any graphics format. It also provides some basic image manipulation functionalityFeatures...

Controlling Object Scope in Ruby 1.9


over 4 years ago by banisterfiend on Like Dream of Banister Fiend.
Sometimes (though not often) it can be handy to have precise control over the lifetime of an object. In C and C++ we can do this by defining a new scope...

What is the Ruby Top-Level?


over 3 years ago by banisterfiend on Like Dream of Banister Fiend.
The Ruby top-level is an interesting place, behaving at times like a class (the Object class) and other times like an object (a plain instance of Object...

Baking module methods into classes with alias_method


over 3 years ago by banisterfiend on Like Dream of Banister Fiend.
Here is a trick to bake a module’s methods directly into a class: module M def hello puts "hello defined in M" end end class C include M alias_method...

What is the Ruby Top-Level?


over 3 years ago by banisterfiend on Like Dream of Banister Fiend.
The Ruby top-level is an interesting place, behaving at times like a class (the Object class) and other times like an object (a plain instance of Object...

Behavior of yield in define_method


over 3 years ago by banisterfiend on Like Dream of Banister Fiend.
At first blush it seems possible to pass blocks implicitly to methods created with define_method by simply using a yield inside the define_method block...

What is the Ruby Top-Level?


over 3 years ago by banisterfiend on Like Dream of Banister Fiend.
The Ruby top-level is an interesting place, behaving at times like a class (the Object class) and other times like an object (a plain instance of Object...

Turning IRB on its head with Pry


~3 years ago by banisterfiend on Like Dream of Banister Fiend.
IRB is a great tool and is perfect for experimenting with small code samples and testing out new ideas. It has some difficulty however when the code samples...