module FileOperation
Public Instance Methods
basename_of_image_file(image_file)
click to toggle source
# File lib/collect_twitter_media/file_operation.rb, line 13 def basename_of_image_file(image_file) File.basename(image_file, '.*') end
make_directory_if_not_exist(directory)
click to toggle source
# File lib/collect_twitter_media/file_operation.rb, line 4 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
remove_image(filename)
click to toggle source
# File lib/collect_twitter_media/file_operation.rb, line 17 def remove_image(filename) File.delete(filename) end
to_pathname(filename_or_dirname)
click to toggle source
# File lib/collect_twitter_media/file_operation.rb, line 21 def to_pathname(filename_or_dirname) Pathname.new(Dir.pwd).join(filename_or_dirname).to_s end