Watch out for reference duplication instead of instance duplication
# This code will generate 96 instances
ViewStatData = Struct.new(:total, :target, :ratio)
96.times.map {|_|ViewStatData.new(0, 0, 0)}# And this will not, it'll generate 96 pointers[ViewStatData.new(0, 0, 0)] * 96# So Watch out!!!
Comments