module AttrUtils::AttrList

Public Class Methods

included(mod) click to toggle source
# File lib/attr-utils/attr_list.rb, line 3
def self.included(mod)
  mod.extend(ClassMethods)
end

Public Instance Methods

list_attr_accessors() click to toggle source

Return attributes' name which has getter and setter methods in the instannce. Hopefully they may identical with attributes defined as “attr_accessor”.

@return [Array<Symbol>]

# File lib/attr-utils/attr_list.rb, line 22
def list_attr_accessors
  my_methods = methods - %w(== === !=).map(&:to_sym)
  my_methods.select{|m| my_methods.find{|m2| "#{m.to_s}=" == m2.to_s  } }
end