Class: Informers::Utils::Hub::FileResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/informers/utils/hub.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ FileResponse

Returns a new instance of FileResponse.



7
8
9
10
11
12
13
14
15
16
# File 'lib/informers/utils/hub.rb', line 7

def initialize(file_path)
  @file_path = file_path

  @exists = File.exist?(file_path)
  if @exists
    @status = ["200", "OK"]
  else
    @status = ["404", "Not Found"]
  end
end

Instance Attribute Details

#existsObject (readonly)

Returns the value of attribute exists.



5
6
7
# File 'lib/informers/utils/hub.rb', line 5

def exists
  @exists
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/informers/utils/hub.rb', line 5

def status
  @status
end

Instance Method Details

#readObject



18
19
20
# File 'lib/informers/utils/hub.rb', line 18

def read
  File.binread(@file_path)
end