def attributes(options = nil)
attributes = clone_attributes :read_attribute
if options.nil?
attributes
else
if except = options[:except]
except = Array(except).collect { |attribute| attribute.to_s }
except.each { |attribute_name| attributes.delete(attribute_name) }
attributes
elsif only = options[:only]
only = Array(only).collect { |attribute| attribute.to_s }
attributes.delete_if { |key, value| !only.include?(key) }
attributes
else
raise ArgumentError, "Options does not specify :except or :only (#{options.keys.inspect})"
end
end
end