Sha256: 7e5981d9302fadb06732a603edf580552cb739b391b86f0c5308b4c50982f7b6

Contents?: true

Size: 919 Bytes

Versions: 13

Compression:

Stored size: 919 Bytes

Contents

# frozen_string_literal: true

require 'ostruct'
require 'eac_ruby_utils/core_ext'

module EhbrsRubyUtils
  module WebUtils
    module Videos
      class File < ::SimpleDelegator
        require_sub __FILE__

        def initialize(data)
          super(data.to_struct)
        end

        def exist?
          ::File.exist?(original_path)
        end

        def move(target_dir)
          ::EhbrsRubyUtils::WebUtils::Videos::File::Rename.new(
            self,
            target_dir.to_pathname.join(original_path.to_pathname.relative_path_from(root_path))
          ).perform
        end

        def path_changed?
          original_path != new_path
        end

        def remove
          return unless exist?

          ::File.unlink(original_path)
        end

        def rename
          ::EhbrsRubyUtils::WebUtils::Videos::File::Rename.new(self, new_path).perform
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.44.3 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.44.2 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.44.1 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.44.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.41.1 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.41.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.40.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.39.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.38.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.37.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.36.1 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.36.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.35.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb