I am relatively new to Ruby. In the below code which redefines the
attr_accessor method i cannot understand the #{attr} and @#{attr}. I
know # as comment and @ as required for a instance variable in Ruby.

class Class
  def attr_access(*attrs)
    attrs.each do |attr|
      class_eval %Q{
      def #{attr}
        @#{attr}
      end
      def #{attr}=(value)
        @#{attr} = value
      end
      }
    end
  end
end

class Foo
 attr_access :a,:b
end

Foo.instance_methods(false) #=> ["b=", "a=", "b", "a"]

-- 
Posted via http://www.ruby-forum.com/.