Hi all,

I have the code below from "mechanize gem" [ the file is module.rb].
am  a newbie in ruby. Could anyone help me redesign the code below to
use either
 (a) block eval   OR (b) not use eval at all.

Thoughts ?

class Module
  def attr_finder(*syms)
    syms.each do |sym|
      class_eval %{ def #{sym.to_s}(hash = nil)
                      if hash == nil
                        @#{sym.to_s}
                      else
                        @#{sym.to_s}.find_all do |t|
                          found = true
                          hash.each_key \{ |key|
                            found = false if t.send(key.to_sym) !=
hash[key]
                          \}
                          found
                        end
                      end
                    end
                  }
    end
  end
end

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to