Class: Annal::Fetch::LocalFile
- Inherits:
-
Object
- Object
- Annal::Fetch::LocalFile
- Defined in:
- lib/annal/fetch/local_file.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(file_identifier) ⇒ LocalFile
constructor
A new instance of LocalFile.
- #local? ⇒ Boolean
- #read ⇒ Object
Constructor Details
#initialize(file_identifier) ⇒ LocalFile
Returns a new instance of LocalFile.
5 6 7 8 9 10 11 |
# File 'lib/annal/fetch/local_file.rb', line 5 def initialize(file_identifier) self.file = if file_identifier.respond_to?(:read) file_identifier else File.open(file_identifier) end end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
4 5 6 |
# File 'lib/annal/fetch/local_file.rb', line 4 def file @file end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/annal/fetch/local_file.rb', line 4 def path @path end |
Instance Method Details
#local? ⇒ Boolean
13 14 15 |
# File 'lib/annal/fetch/local_file.rb', line 13 def local? true end |
#read ⇒ Object
17 18 19 |
# File 'lib/annal/fetch/local_file.rb', line 17 def read @read ||= file.read end |