Sha256: 36cd86cf3b462b3c3847dc8ee8c90e7031b60334e38e508c53ad4c780d0f4763

Contents?: true

Size: 622 Bytes

Versions: 53

Compression:

Stored size: 622 Bytes

Contents

class File
  def self.write(to, content)
    File.open(to, 'wb'){|f| f.write(content) }
  end
  
  # Open files in binary mode. On linux this is ignored by ruby.
  # On Windows ruby open files in text mode by default, so it replaces \r with \n,
  # so the specs fail. If files are opened in binary mode, which is the only mode 
  # on linux, it does not replace the newlines. This thread has slightly more information:
  # http://groups.google.com/group/rubyinstaller/browse_thread/thread/c7fbe346831e58cc
  def self.binary_read(file)
    io = File.open(file, 'rb')
    content = io.read
    io.close
    content
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
ruco-0.2.5 lib/ruco/core_ext/file.rb
ruco-0.2.4 lib/ruco/core_ext/file.rb
ruco-0.2.3 lib/ruco/core_ext/file.rb
ruco-0.2.2 lib/ruco/core_ext/file.rb
ruco-0.2.1 lib/ruco/core_ext/file.rb
ruco-0.2.0 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta12 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta11 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta10 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta9 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta8 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta7 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta6 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta5 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta4 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta3 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta2 lib/ruco/core_ext/file.rb
ruco-0.2.0.beta lib/ruco/core_ext/file.rb
ruco-0.1.14 lib/ruco/core_ext/file.rb
ruco-0.1.13 lib/ruco/core_ext/file.rb