Sha256: 9fabe877a1489f969673e6fa895acf4f12803aa578ec6eb89ce293ca4a6370fc

Contents?: true

Size: 516 Bytes

Versions: 17

Compression:

Stored size: 516 Bytes

Contents

require 'fileutils'

module Evva
  class FileReader
    def open_file(file_name, method, should_exist)
      unless File.file?(File.expand_path(file_name))
        if should_exist
          Logger.error("File #{file_name} not found!")
          return nil
        else
          FileUtils.mkdir_p(File.dirname(file_name))
        end
      end

      File.open(File.expand_path(file_name), method)
    end

    def write_to_file(file, data)
      file.write(data)
      file.flush
      file.close
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
evva-0.4.4 lib/evva/file_reader.rb
evva-0.4.3 lib/evva/file_reader.rb
evva-0.4.2 lib/evva/file_reader.rb
evva-0.4.1 lib/evva/file_reader.rb
evva-0.4.0 lib/evva/file_reader.rb
evva-0.3.0 lib/evva/file_reader.rb
evva-0.2.0 lib/evva/file_reader.rb
evva-0.1.4.4 lib/evva/file_reader.rb
evva-0.1.4.3 lib/evva/file_reader.rb
evva-0.1.4.2 lib/evva/file_reader.rb
evva-0.1.4.1 lib/evva/file_reader.rb
evva-0.1.4 lib/evva/file_reader.rb
evva-0.1.3.1 lib/evva/file_reader.rb
evva-0.1.3 lib/evva/file_reader.rb
evva-0.1.2 lib/evva/file_reader.rb
evva-0.1.1 lib/evva/file_reader.rb
evva-0.1.0 lib/evva/file_reader.rb