Class: EhbrsRubyUtils::WebUtils::Videos::File
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- EhbrsRubyUtils::WebUtils::Videos::File
- Defined in:
- lib/ehbrs_ruby_utils/web_utils/videos/file.rb,
lib/ehbrs_ruby_utils/web_utils/videos/file/rename.rb
Defined Under Namespace
Classes: Rename
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(data) ⇒ File
constructor
A new instance of File.
- #move(target_dir) ⇒ Object
- #path_changed? ⇒ Boolean
- #remove ⇒ Object
- #rename ⇒ Object
Constructor Details
#initialize(data) ⇒ File
Returns a new instance of File.
9 10 11 |
# File 'lib/ehbrs_ruby_utils/web_utils/videos/file.rb', line 9 def initialize(data) super(data.to_struct) end |
Instance Method Details
#exist? ⇒ Boolean
13 14 15 |
# File 'lib/ehbrs_ruby_utils/web_utils/videos/file.rb', line 13 def exist? ::File.exist?(original_path) end |
#move(target_dir) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ehbrs_ruby_utils/web_utils/videos/file.rb', line 17 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 |
#path_changed? ⇒ Boolean
24 25 26 |
# File 'lib/ehbrs_ruby_utils/web_utils/videos/file.rb', line 24 def path_changed? original_path != new_path end |
#remove ⇒ Object
28 29 30 31 32 |
# File 'lib/ehbrs_ruby_utils/web_utils/videos/file.rb', line 28 def remove return unless exist? ::File.unlink(original_path) end |
#rename ⇒ Object
34 35 36 |
# File 'lib/ehbrs_ruby_utils/web_utils/videos/file.rb', line 34 def rename ::EhbrsRubyUtils::WebUtils::Videos::File::Rename.new(self, new_path).perform end |