A little confused: My aim is to get an array of only the methods I create in my class. For example, in the class below if I am successful I should see a list of three methods: [:subject, :affiliate, :address].
I know I can ask for class#methods, but that gives me a lot of inherited methods (see below). I see online that if I call class#methods(false) then I should get my desired response, however when I try this on this class, I get , empty array. Is there a way to do this? Reason why I want this is so I can iterate my methods on initialize and set default values, to avoid @subect="" @affiliate=""… etc. Of course my real class is much bigger than three methods otherwise would not worry about it.
ruby-1.9.2-p0 > class Entry
ruby-1.9.2-p0 ?> attr_accessor :subject,
ruby-1.9.2-p0 > :affiliate,
ruby-1.9.2-p0 > :address
ruby-1.9.2-p0 ?> end
ruby-1.9.2-p0 > e = Entry.new
ruby-1.9.2-p0 > e.methods(false)
ruby-1.9.2-p0 > e.methods
=> [:subject, :subject=, :affiliate, :affiliate=, :address, :address=, :taguri=, :taguri, :to_yaml_style, :to_yaml_properties, :syck_to_yaml, :to_yaml, :blank?, :present?, :presence, :duplicable?, :acts_like?, :try, :html_safe?, :`, :returning, :to_param, :to_query, :instance_values, :instance_variable_names, :copy_instance_variables_from, :to_json, :with_options, :as_json, :require_or_load, :require_dependency, :require_association, :load_dependency, :load, :require, :unloadable, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :to_sql, :equality_predicate_sql, :inequality_predicate_sql, :bind, :find_correlate_in, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :id, :object_id, :to_enum, :enum_for, :gem, :silence_warnings, :enable_warnings, :with_warnings, :silence_stderr, :silence_stream, :suppress, :class_eval, :pretty_inspect, :require_library_or_gem, :debugger, :breakpoint, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :send]