eval_api_类中类_map
(一)eval("a=1;b=2;puts a+b")运行结果 vagrant@vagrant-Ubuntu-trusty-64:/vagrant/test_PRoject$ ruby Apple4.rb 3(二)查看api Reference Documentation就是API(三)类中类及类中类之方法class Fruit COLOR='red' class Apple COLOR='red' def size puts 'big' end end end puts Fruit::Apple::COLOR puts Fruit::Apple.new.size运行结果vagrant@vagrant-ubuntu-trusty-64:/vagrant/test_project$ ruby Apple4.rb red big(四)map用法result=[1,2,3].map do |e| e*e end puts result.inspect