Method: Module#mattr_reader
- Defined in:
- lib/active_support/core_ext/module/attribute_accessors.rb
#mattr_reader(*syms) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/active_support/core_ext/module/attribute_accessors.rb', line 14 def mattr_reader(*syms) syms.each do |sym| next if sym.is_a?(Hash) class_eval(<<-EOS, __FILE__, __LINE__) unless defined? @@#{sym} @@#{sym} = nil end def self.#{sym} @@#{sym} end def #{sym} @@#{sym} end EOS end end |