Method: Module#mattr_reader
- Defined in:
- lib/attribute_accessors.rb
#mattr_reader(*syms) ⇒ Object
:nodoc:
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/attribute_accessors.rb', line 4 def mattr_reader(*syms) syms.each do |sym| class_eval(<<-EOS, __FILE__, __LINE__) unless defined? @@#{sym} @@#{sym} = nil end def self.#{sym} @@#{sym} end def #{sym} @@#{sym} end EOS end end |