method
cattr_writer
v2.1.0 -
Show latest stable
- Class:
Class
cattr_writer(*syms)public
No documentation available.
# File activesupport/lib/active_support/core_ext/class/attribute_accessors.rb, line 30
def cattr_writer(*syms)
options = syms.extract_options!
syms.flatten.each do |sym|
class_eval("unless defined? @@\#{sym}\n@@\#{sym} = nil\nend\n\ndef self.\#{sym}=(obj)\n@@\#{sym} = obj\nend\n\n\#{\"\ndef \#{sym}=(obj)\n@@\#{sym} = obj\nend\n\" unless options[:instance_writer] == false }\n", __FILE__, __LINE__)
end
end 1Note
Description
Similar to Ruby's built-in +attr_writer+, only it creates a class attribute writer method (as opposed to an instance attribute writer method).