Just a small nitpick:

  if other.is_a? TimeInterval
    TimeInterval.new(value + other.value)
  elsif other.is_a? Numeric
    TimeInterval.new(value + other)
  else
    raise TypeError, "#{other.class} can't be coerced into TimeInterval"
  end

would probably be better written as:

  case other
  when TimeInterval
    TimeInterval.new(value + other.value)
  when Numeric
    TimeInterval.new(value + other)
  else raise TypeError, "#{other.class} can't be coerced into TimeInterval"
  end

On Wed, Jan 26, 2011 at 7:58 AM, zdennis <zach.dennis / gmail.com> wrote:

> A fellow rubyist, Zach Church, wrote a great article on coercion in
> Ruby. It's not something I've seen covered often so I thought I'd
> share with the community at large:
>
> http://mutuallyhuman.com/blog/2011/01/25/class-coercion-in-ruby
>
> Zach Dennis
>
>


-- 
Tony Arcieri
Medioh! Kudelski