Class: Borrower::Content::Item
- Inherits:
-
Object
- Object
- Borrower::Content::Item
- Defined in:
- lib/borrower/content.rb
Instance Method Summary collapse
- #content ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(path) ⇒ Item
constructor
A new instance of Item.
- #remote? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ Item
Returns a new instance of Item.
27 28 29 |
# File 'lib/borrower/content.rb', line 27 def initialize path @path = path end |
Instance Method Details
#content ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/borrower/content.rb', line 43 def content if remote? && exists? @_response.body else IO.read( @path ) end end |
#exists? ⇒ Boolean
35 36 37 38 39 40 41 |
# File 'lib/borrower/content.rb', line 35 def exists? if remote? return ( fetch_from_remote(@path).msg.include? "OK" ) else return File.exists? @path end end |
#remote? ⇒ Boolean
31 32 33 |
# File 'lib/borrower/content.rb', line 31 def remote? @_remote ||= is_remote? end |