Class: LocalFileAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/utils/adapters.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ LocalFileAdapter

This adapter will wrap a local file path and provide a download method that yields the file’s contents



3
4
5
# File 'lib/utils/adapters.rb', line 3

def initialize(file_path)
  @file_path = file_path
end

Instance Method Details

#downloadObject



7
8
9
10
11
# File 'lib/utils/adapters.rb', line 7

def download
  File.open(@file_path, 'rb') do |file|
    yield file.read
  end
end