Sha256: aecb68e0cfea09e69b12517cf124a8d0dbf959c934d03ad65cfbb254d8c1413e

Contents?: true

Size: 927 Bytes

Versions: 44

Compression:

Stored size: 927 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(::OpenStruct.new(data))
        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

44 entries across 44 versions & 2 rubygems

Version Path
ehbrs_ruby_utils-0.33.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.32.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.31.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.30.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.29.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.28.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.27.1 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.27.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.26.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.25.1 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.25.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.24.1 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.24.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.23.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.22.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.21.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.20.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.19.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.18.0 lib/ehbrs_ruby_utils/web_utils/videos/file.rb
ehbrs_ruby_utils-0.17.3 lib/ehbrs_ruby_utils/web_utils/videos/file.rb