StarTrader added about 2 hours later: I like the implementation as a concept, but I am concerned about what the results would be for client code. This would seem to encourage the creation of an arbitrarily large number of Error classes. To my mind the goal of raising an error is to ha...
James Edward Gray II joined the Ruby community in 2004 and they just haven't been able to get rid of him since then. James writes Ruby code for fun and profit, pens books with a good deal of Ruby in them, gives speeches about the language, and runs the local support group for Ruby add...
James Edward Gray II joined the Ruby community in 2004 and they just haven't been able to get rid of him since then. James writes Ruby code for fun and profit, pens books with a good deal of Ruby in them, gives speeches about the language, and runs the local support group for Ruby add...
James Edward Gray II added about 1 month later: Ruby has another interesting exception when it comes to Encoding incompatibility that may be worth mentioning. You can't typically add String s with incompatible Encoding s as this shows: $ cat incompatible.rb # encoding: UTF-8 utf8 = "一...
#!/usr/bin/env ruby -wKU require "rubygems" require "redis" CLEAR = `clear` # create an article to comment on db = Redis.new article_id = db.incr("global:next_article_id") article = "article:#{article_id}" class << article def method_missing(field, *args, &blk) return super unless fie...
Lone Star Rubyconf Slides Posted over 3 years ago in Conferences . I've had a couple of requests for my slides from Lone Star Rubyconf. Here are those links for those who want them: At LSRC 2007 I gave a Ruby as a Glue Language speech . You can download my slides , if you like. I also...
Posted over 3 years ago in Ruby Tutorials and Ruby Voodoo . There's an argument that rages in the Ruby camps: to instance_eval() or not to instance_eval() . Most often this argument is triggered by DSL discussions where we tend to want code like: configurable.config do width 100 mode ...
James Edward Gray II added 2 days later: I'm happy to explain the required parentheses, yes. super is one of those magical keywords in Ruby. It often looks like a normal method call, but it has a little magic involved. When you call super without any parentheses, it invokes a method o...
Another limit you may want to consider setting is the maximum memory limit. If you plan to use Redis as a memcached replacement, you will likely wish to control how much memory it can consume. You can set the maximum number of bytes Redis can allocate, after which it will start purgin...
The downside is that the new code comes with a good size learning curve. I would know because I recently battled through figuring it out so I could add support to the standard CSV library for nearly all of the encodings. It was a battle too. It's brave new territory and there's not a ...