November 29, 2007 at 6:16 pm
· Filed under 1.9, irb, ruby
Wirble, which is awesome, uses syntax in its case blocks that break Ruby 1.9.0. It’s too bad. Wirble makes irb so much nicer to look at and use (although, I do have to say that I don’t use its prompt or history features, but maybe only through old stubbornness).
Anyway, if you’re using 1.9 alongside 1.8, it’s nice when everything works the same. And so, here’s a simple patch for wirble.rb (the only file when you install the gem). Apply it to your gems/1.9/gems/wirble-0.1.2/wirble.rb (usually in /usr/local/lib/ruby/) and there you go.
Permalink
October 15, 2007 at 12:23 pm
· Filed under 1.9, ruby
I wanted to see if my WAV file wrapper would work in 1.9. I didn’t see any reason why it shouldn’t, but little things change here and there, so you never know.
Well, something did go wrong. I know this is sloppy, but I was getting the octave of notes from something like this:
note.match(/\d+$/)[0] rescue 4
It turns out that NoMethodError is no longer a descendant of StandardError, and is thus no longer rescued by that rescue. So when the note didn’t have its octave in tow, note.match(/\d+$/) was returning nil, and nil doesn’t have a method [], but it would cruise right past the rescue clause.
A quick fix (a simple exercise left for the reader), and Ruby 1.9 is making me beautiful sounds:
Permalink
September 21, 2007 at 10:18 am
· Filed under 1.9, ruby
I finally got the 1.9 itch bad enough. I didn’t see any brainlessly simple “Install Ruby 1.9 alongside 1.8.x” guides, and as I’m relatively new to serious Unix-y system usage I like those kinds of things. Anyway, in the event that someone’s looking for a brainlessly simple “Install Ruby 1.9 alongside 1.8.x” guide:
svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby19
cd ruby19
autoconf
./configure --prefix=/usr/local --program-suffix=19 --with-readline-dir=/usr/local
make
sudo make install
Certainly, old hands have this down, and much of this is in the README. But the secret is --program-suffix=19, which leaves ruby alone and gives you ruby19 as your 1.9 executable.
Then I ran the benchmark stuff from this thread, and here’s how it went:
mvb:~ cms$ ruby calculate.rb
55
Ruby 1.8.6 patch 0 on i686-darwin8.9.1
It took 9.167413 seconds to run. 109082 iterations per
second.
mvb:~ cms$ ruby19 calculate.rb
55
Ruby 1.9.0 patch 0 on i686-darwin8.10.1
It took 3.059674 seconds to run. 326832 iterations per
second.
Permalink