Strange Array#each Ruby behaviour
- by with a dot.
The question is a bit vague, but I am not really sure why this happens:
I have the following code:
p user.room.users.length
user.room.users.each {|usr| puts "b" }
user.room.users.each {|usr| puts "a"; usr.enter(Room[Config::entrance]) }
which outputs:
5
b
b
b
b
b
a
a
a
I also made User#enter count how many times it's been called and it returns 3! I am completely baffled by this behaviour. I doubt the code within User#enter is the cause, but if someone thinks it might be relevant I can provide it (I don't want to clutter the question unnecessarily).
Edit
If it's relevant I am using ruby-1.9.3-p125