Class: Slices::Asset::Rename::Fog

Inherits:
Base
  • Object
show all
Defined in:
lib/slices/asset/rename.rb

Instance Attribute Summary

Attributes inherited from Base

#file, #new_file_name

Instance Method Summary collapse

Methods inherited from Base

#initialize, #run

Constructor Details

This class inherits a constructor from Slices::Asset::Rename::Base

Instance Method Details

#directoryObject



60
61
62
# File 'lib/slices/asset/rename.rb', line 60

def directory
  @directory ||= file.send(:directory)
end

#new_pathObject



45
46
47
# File 'lib/slices/asset/rename.rb', line 45

def new_path
  @new_path[1 .. -1]
end

#rename(style) ⇒ Object



49
50
51
52
53
54
55
56
57
58
# File 'lib/slices/asset/rename.rb', line 49

def rename(style)
  super
  file = directory.files.new(key: @old_path)
  file.copy(
    directory.key,
    @new_path,
    {'x-amz-acl' => 'public-read'}
  )
  file.destroy
end