facebook careers puzzle – Hoppity Hop! – in Ruby

https://www.facebook.com/careers/puzzles.php?puzzle_id=7

A pretty simple puzzle just to get things started. Hoppity Hop!

def hoppity_hop
	#fetch the file name from the command prompt input
	file_name = ARGV[0]
	#read the contents from the file and convert to integer
	file_content = File.read(file_name).to_i
 
	#run loop from 1 to the number in file
	1.upto(file_content) do |i|
		if i % 3 == 0 && i % 5 == 0
			puts "Hop\n"
		else
			puts "Hoppity\n" if i % 3 == 0
			puts "Hophop\n" if i % 5 == 0
		end
 
	end
end
 
hoppity_hop