Sha256: ccf4ff0d41c1546079302480a28126b60682bb2feb2018351a3aeafc1e162fd6

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

require 'pathname'

module FileOperation
  def make_directory_if_not_exist(directory)
    directory = Pathname.new(change_to_fullpath(directory)).to_s
    unless File.exists?(directory)
      command = "mkdir #{directory}"
      `#{command}`
    end
    directory
  end

  def basename_of_image_file(image_file)
    File.basename(image_file, '.*')
  end

  def remove_image_file(filename)
    File.delete(filename)
  end

  def change_to_fullpath(filename)
    Pathname.new(Dir.pwd).join(filename).to_s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crop_pokemori_prof_image-0.1.0 lib/crop_pokemori_prof_image/file_operation.rb