Russell McConnachie
2008-Jan-09 23:00 UTC
Dynamically lookup setter methods defined by a instanciated class.
Is there any cleaner way than this to get all setter methods of a instantiated class? class ABC attr_accessor :a attr_accessor :b attr_accessor :c attr_reader :d attr_writer :e end abc = ABC.new puts abc.public_methods.collect! { |m| m if m =~ /[[:alpha:]]=$/ }.delete_if { |m| m.nil? } >> require ''test.rb'' aebc=> true Thanks. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---