Class: Informers::Utils::Hub::FileResponse
- Inherits:
-
Object
- Object
- Informers::Utils::Hub::FileResponse
- Defined in:
- lib/informers/utils/hub.rb
Instance Attribute Summary collapse
-
#exists ⇒ Object
readonly
Returns the value of attribute exists.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ FileResponse
constructor
A new instance of FileResponse.
- #read ⇒ Object
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
#exists ⇒ Object (readonly)
Returns the value of attribute exists.
5 6 7 |
# File 'lib/informers/utils/hub.rb', line 5 def exists @exists end |
#status ⇒ Object (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
#read ⇒ Object
18 19 20 |
# File 'lib/informers/utils/hub.rb', line 18 def read File.binread(@file_path) end |