Binary numbers challenge I don't know if this is exactly refactoring but I recently completed a programming challenge to learn more about Ruby's iterators. However, I feel that the code is extremely "un-Ruby like". Would anyone have any suggestions as to how I could improve it?

numbers = []
binary = []
binary_count = 0

File.open('decimals.txt').each_line do |line|
  numbers.push line.chomp
end

numbers.each do |number|
  binary.push number.to_i.to_s(2)
end

binary.each do |binary_num|
 binary_count += binary_num.count("1") 
end

puts binary_count


Yes, I know it's a basic problem. It took me roughly five minutes to complete but it was more about just getting the syntax of the iterators down.
I would not open a stream instead use IO.readlines and enum methods:

puts File.readlines("decimals.txt").reduce(0) { |total, line| total += line.chomp.to_i.to_s(2).count("1") }