On Sat, Jun 6, 2009 at 7:57 AM, Kga Agk<lord_kga / yahoo.no> wrote:
>
> t = gets
> puts t
>
> k = gets
> puts k
>
> end
>
>
> test2.rb
>
> testing
>

This works:

def testing
  t = gets
  puts t

  k = gets
  puts k

end


require 'stringio'

$stdin = StringIO.new("abc\ndef\n")

testing

Of course you'd want to set $stdin to the open file.


-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale