Class: Potatochop::FileSystemInterface
- Inherits:
-
Object
- Object
- Potatochop::FileSystemInterface
- Defined in:
- lib/potatochop/file_system_interface.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #exists?(file_name) ⇒ Boolean
-
#initialize(source, options = {}) ⇒ FileSystemInterface
constructor
A new instance of FileSystemInterface.
- #read(file_name) ⇒ Object
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, = {}) @source = source end |
Instance Attribute Details
#source ⇒ Object (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
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 |