File operation in Ruby