在MacOSXLion上使用Rubyv1.8.7和Daemonsv1.1.8,我试图编写一个消费者进程并让它作为守护进程运行:#config[:name]=>'idx_my_delete_consumer'#config[:daemon]=>{:multiple=>false,#:backtrace=>true,#:dir_mode=>:normal,#:log_dir=>'/Users/pprakash/consumer.log',#:monitor=>true,#:dir=>'/Users/pprakash/pids'}Daemons.run_proc(config[:name],
我一直在看maxmethod在Ruby的Enumerable混合(v2.4.1)。这是一个相当简单的方法,但是当存在重复项时它如何排序项目有点令人困惑。例如:x=[1,2,3,4,5,6,7,8,9]x.max{|a,b|a%2b%2}=>110.times{|y|px.max(y){|a,b|a%2b%2}}[][1][1,7]#whyis7thenextelementafter1?[3,1,5]#whynomore7?[7,3,1,5]#7isnowfirst[9,7,3,1,5][9,7,3,1,5,6][9,7,3,1,5,4,6][9,7,3,1,5,2,4,6][9,7,5