Instead of passing class names as strings, why not ref the classes
themselves?  Lame example, but ... something like:

  ...
  def first_last_count(clss)
    return [clss.find(:first), clss.find(:last), clss.count]
  end

  ...
  first_car,last_car,count_cars = first_last_count(Car)
  ...
  first_bike,last_bike,count_bikes = first_last_count(Bike)
  ...

Jeff

On Feb 28, 1:27 pm, ms <m...@tzi.de> wrote:
> Hello,
>
> I've got some code, which I would like to reuse. The only difference
> between the usages are the class names and therefore the different
> objects. How would you manage this? Is there a way to take the class
> names as strings? Do you know other solutions, a suitable pattern, for
> example?
>
> Thanx for any suggestions!
>
> Best regards, ms
--~--~---------~--~----~------------~-------~--~----~
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-talk@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