forwardable: support for 'delegate :method => :accessor'
A few months ago, I met a bug with lib/forwardable.rb:
delegate :method => :accessor
would not work, although mentioned in the documentation.
Keiju solved this at r31507, being faster than me :)
However, I would still like to propose my solution.
#instance_delegate and #single_delegate both accept
a Symbol-Symbol pair (:method => :accessor)
and a Array-Symbol pair ([:method1, :method2] => :accessor).
The current code looks like:
methods = [methods] unless methods.respond_to?(:each)
I believe this is a good use for Kernel#Array, and it does not depend on #each being defined on Symbol/String.
While I am at it, I would like to advise to not use the fact String#each for a single line String used to yield the whole String.
This is likely not what #each is intended for, and broke with 1.9, which undefined String#each.
I began to write a few tests for forwardable, is it better to add them in test/ or RubySpec ?