Class: Potatochop::FileSystemInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/potatochop/file_system_interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, options = {}) ⇒ FileSystemInterface

Returns a new instance of FileSystemInterface.



5
6
7
# File 'lib/potatochop/file_system_interface.rb', line 5

def initialize(source, options = {})
  @source = source
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



3
4
5
# File 'lib/potatochop/file_system_interface.rb', line 3

def source
  @source
end

Instance Method Details

#exists?(file_name) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/potatochop/file_system_interface.rb', line 9

def exists?(file_name)
  file_path = File.join(@source, file_name)
  File.exists? file_path
end

#read(file_name) ⇒ Object



14
15
16
17
# File 'lib/potatochop/file_system_interface.rb', line 14

def read(file_name)
  file_path = File.join(@source, file_name)
  File.read(file_path)
end