Sha256: bfc7e7ae2618d67004a2914ead269895ebd09b93f4b15fa9da13ee9ff0f2ca9f

Contents?: true

Size: 437 Bytes

Versions: 1

Compression:

Stored size: 437 Bytes

Contents

require 'fileutils'

class FileHelper
  attr_reader :dir

  def initialize(dir)
    @dir = dir
  end

  def new_file(filename, contents)
    new_post_file = File.new("#{dir}/#{filename}", 'w')
    new_post_file.write(contents)
    new_post_file.close
  end

  def read_file(filename)
    File.open("#{dir}/#{filename}", 'r') do |file|
      file.read()
    end
  end

  def mkdir_p(dir)
    FileUtils.mkdir_p("#{@dir}/#{dir}")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ignoramos-1.1.0 lib/file_helper.rb