module AttrUtils::AttrList::ClassMethods
Public Instance Methods
list_attr_accessors()
click to toggle source
Return attributes' name which has getter and setter methods in the class. Hopefully they may identical with attributes defined as “attr_accessor”.
@return [Array<Symbol>]
# File lib/attr-utils/attr_list.rb, line 12 def list_attr_accessors my_methods = instance_methods - %w(== === !=).map(&:to_sym) my_methods.select{|m| my_methods.find{|m2| "#{m.to_s}=" == m2.to_s } } end