Sha256: dd532f4149692ea42a16b1271fe77e48700a7315769f25c8ff953c7df1721cab

Contents?: true

Size: 516 Bytes

Versions: 2

Compression:

Stored size: 516 Bytes

Contents

require 'pathname'

module FileOperation
  def make_directory_if_not_exist(directory)
    directory = Pathname.new(to_pathname(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(filename)
    File.delete(filename)
  end

  def to_pathname(filename_or_dirname)
    Pathname.new(Dir.pwd).join(filename_or_dirname).to_s
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
collect_twitter_media-1.1.4 lib/collect_twitter_media/file_operation.rb
collect_twitter_media-1.1.3 lib/collect_twitter_media/file_operation.rb