instance method
mattr_reader
Ruby on Rails 3.1.12
Since v2.2.3Signature
mattr_reader(*syms)
No documentation comment.
Parameters
-
symsrest
Source
# File activesupport/lib/active_support/core_ext/module/attribute_accessors.rb, line 4
def mattr_reader(*syms)
options = syms.extract_options!
syms.each do |sym|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
@@#{sym} = nil unless defined? @@#{sym}
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/module/attribute_accessors.rb line 4
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Module