Class: Borrower::Content::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/borrower/content.rb

Instance Method Summary collapse

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

#contentObject



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

Returns:

  • (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

Returns:

  • (Boolean)


31
32
33
# File 'lib/borrower/content.rb', line 31

def remote?
  @_remote ||= is_remote?
end