class ChildrenArray < Array
attr_accessor :parent
def initialize(parent, *params)
self.parent = parent
puts ">>>>>>"
params.each {|x| puts( x.class.name + ' : ' + x.inspect) }
puts "<<<<<<"
super(*params)
# How does it work, that the block passed to initialize is passed
# further to this super call?
end
end
p = "PARENT"
a = ChildrenArray.new(p, 3) {|i| i*100} # ==> [0, 100, 200]
# >>>>>>
# Fixnum : 3
# <<<<<<
# => [0, 100, 200]
a.parent
# ==> "PARENT"
# so, the constructor works, and the block apparently is somehow passed
# to the call to super(). Why?
# What should I do in case I would want the block to NOT be passed?
# The output shows that the block is not included in the params array.