I was under the impression that each element of the ARGV arrays contains a value (non iterable). However, when I run this
and run it with ruby test.rb 1 2 3
I can see that each element is again an array, with one element each.
Is this expected?
Code:
def test(args)
args.each do |arg|
puts arg.respond_to?("each")
arg.each do |a|
puts a
end
end
if __FILE__ == $0
test(ARGV)
end
I can see that each element is again an array, with one element each.
Is this expected?
Comment