Sha256: cd16b503ffdf969f5d9e60c4eb11fc71ef574cca674424230d9ee47d502a9511
Contents?: true
Size: 782 Bytes
Versions: 23
Compression:
Stored size: 782 Bytes
Contents
# frozen_string_literal: true require 'ostruct' module EhbrsRubyUtils module WebUtils module Videos class File < ::SimpleDelegator def initialize(data) super(::OpenStruct.new(data)) end def exist? ::File.exist?(original_path) end def path_changed? original_path != new_path end def can_rename? ::File.exist?(original_path) && !::File.exist?(new_path) end def remove return unless exist? ::File.unlink(original_path) end def rename return unless can_rename? ::FileUtils.mkdir_p(::File.dirname(new_path)) ::FileUtils.mv(original_path, new_path) end end end end end
Version data entries
23 entries across 23 versions & 2 rubygems