Class: Fog::Storage::Local::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/local/storage.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Real) initialize(options = {})



65
66
67
68
69
# File 'lib/fog/local/storage.rb', line 65

def initialize(options={})
  @local_root = ::File.expand_path(options[:local_root])

  @endpoint = options[:endpoint] || build_endpoint_from_options(options)
end

Instance Attribute Details

- (Object) endpoint (readonly)

Returns the value of attribute endpoint



63
64
65
# File 'lib/fog/local/storage.rb', line 63

def endpoint
  @endpoint
end

Instance Method Details

- (Object) copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options = {})



79
80
81
82
83
84
85
# File 'lib/fog/local/storage.rb', line 79

def copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options={})
  require 'fileutils'
  source_path = path_to(::File.join(source_directory_name, source_object_name))
  target_path = path_to(::File.join(target_directory_name, target_object_name))
  ::FileUtils.mkdir_p(::File.dirname(target_path))
  ::FileUtils.copy_file(source_path, target_path)
end

- (Object) local_root



71
72
73
# File 'lib/fog/local/storage.rb', line 71

def local_root
  @local_root
end

- (Object) path_to(partial)



75
76
77
# File 'lib/fog/local/storage.rb', line 75

def path_to(partial)
  ::File.join(@local_root, partial)
end