kuerlulu 发表于 2014-7-7 21:04 嗯如果你能看懂上面这个的话
class MyClass; end class << MyClass private def attr_reader(*syms) class_eval syms.map {|sym| "def #{sym}\n@#{sym}\nend" }.join("\n") endend
class MyClass; end class << MyClass private def attr_reader(*syms) class_eval syms.map {|sym| "def #{sym}\n@#{sym}\nend" }.join("\n") end end