Class: Annal::Fetch::NetFile

Inherits:
Object
  • Object
show all
Defined in:
lib/annal/fetch/net_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_identifier) ⇒ NetFile

Returns a new instance of NetFile.



7
8
9
10
11
12
13
# File 'lib/annal/fetch/net_file.rb', line 7

def initialize(file_identifier)
  self.file = if file_identifier.respond_to?(:read)
    file_identifier
  else
    self.file = RestClient.get(file_identifier)
  end
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



6
7
8
# File 'lib/annal/fetch/net_file.rb', line 6

def file
  @file
end

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/annal/fetch/net_file.rb', line 6

def path
  @path
end

Instance Method Details

#local?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/annal/fetch/net_file.rb', line 15

def local?
  false
end

#readObject



19
20
21
# File 'lib/annal/fetch/net_file.rb', line 19

def read
  @read ||= file.to_str
end