11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/purgatory/attribute_accessor_fields.rb', line 11
def self.determine_attr_accessor_fields(obj)
local_attributes = obj.class.instance_variable_get(:@local_attributes_for_purgatory)
variables = if local_attributes == :all
ActiveRecordDescendantAttributeAccessors.attr_accessor_instance_variables(obj)
else
Array(local_attributes).map { |attribute|
attribute.to_s.prepend('@').to_sym
}
end
variables.inject({}) do |hash,var|
hash[var] = obj.instance_variable_get(var)
hash
end
end
|