instance method
cattr_reader
Ruby on Rails 3.1.12
Since v2.2.3 Last seen in v4.0.13Signature
cattr_reader(*syms)
No documentation comment.
Parameters
-
symsrest
Source
# File activesupport/lib/active_support/core_ext/class/attribute_accessors.rb, line 28
def cattr_reader(*syms)
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
unless defined? @@#{sym}
@@#{sym} = nil
end
def self.#{sym}
@@#{sym}
end
EOS
unless options[:instance_reader] == false
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
def #{sym}
@@#{sym}
end
EOS
end
end
end
Defined in activesupport/lib/active_support/core_ext/class/attribute_accessors.rb line 28
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Class