someara/line-cookbook — pull request #9 by jgartrel (2013-08-11 16:23:46+00:00)
Title: Use explicit path method for compatitibility with older ruby

It appears that fileutils in older ruby does not accept a 'File' object as a parameter and copy fails without using the ".path" method for temp file

Older Ruby:
# ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
# irb
irb(main):001:0> require 'tempfile'
=> true
irb(main):002:0> f = Tempfile.new("t1")
=> #
irb(main):003:0> FileUtils.copy(f, "/tmp/t2")
NoMethodError: undefined method `to_str' for #
from /usr/lib/ruby/1.8/delegate.rb:269:in `method_missing'
from /usr/lib/ruby/1.8/fileutils.rb:1414:in `fu_each_src_dest0'
from /usr/lib/ruby/1.8/fileutils.rb:1400:in `fu_each_src_dest'
from /usr/lib/ruby/1.8/fileutils.rb:382:in `copy'
from (irb):3
from /usr/lib/ruby/1.8/fileutils.rb:1133
irb(main):004:0>

Newer Ruby:
# ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.3.0]
# irb
irb(main):001:0> require 'tempfile'
=> true
irb(main):002:0> f = Tempfile.new("t1")
=> #
irb(main):003:0> FileUtils.copy(f, "/tmp/t2")
=> nil