class Fog::Local::Storage::Real

Attributes

endpoint[R]

Public Class Methods

new(options={}) click to toggle source
# File lib/fog/local/storage.rb, line 68
def initialize(options={})
  @local_root = ::File.expand_path(options[:local_root])

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

Public Instance Methods

copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options={}) click to toggle source
# File lib/fog/local/storage.rb, line 82
def copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options={})
  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
local_root() click to toggle source
# File lib/fog/local/storage.rb, line 74
def local_root
  @local_root
end
path_to(partial) click to toggle source
# File lib/fog/local/storage.rb, line 78
def path_to(partial)
  ::File.join(@local_root, partial)
end

Private Instance Methods

build_endpoint_from_options(options) click to toggle source
# File lib/fog/local/storage.rb, line 90
def build_endpoint_from_options(options)
  return unless options[:host]

  URI::Generic.build(options).to_s
end