class Pansophy::Remote::FetchFile

Public Class Methods

new(bucket, path) click to toggle source
# File lib/pansophy/remote/fetch_file.rb, line 6
def initialize(bucket, path)
  @bucket   = bucket
  @pathname = Pathname.new(path)
end

Public Instance Methods

call() click to toggle source
# File lib/pansophy/remote/fetch_file.rb, line 11
def call
  fail ArgumentError, "#{@pathname} does not exist" if file.nil?
  file
end

Private Instance Methods

directory() click to toggle source
# File lib/pansophy/remote/fetch_file.rb, line 23
def directory
  ReadDirectory.new(@bucket, @pathname).call
end
file() click to toggle source
# File lib/pansophy/remote/fetch_file.rb, line 18
def file
  directory.files.find { |file| file.key == @pathname.to_s }
end