Class: GetaroundUtils::Utils::HealthCheckFile
- Inherits:
-
Object
- Object
- GetaroundUtils::Utils::HealthCheckFile
- Defined in:
- lib/getaround_utils/utils/health_check_file.rb
Constant Summary collapse
- FILE_NAME =
'health_check_file'
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(name) ⇒ HealthCheckFile
constructor
A new instance of HealthCheckFile.
Constructor Details
#initialize(name) ⇒ HealthCheckFile
Returns a new instance of HealthCheckFile.
15 16 17 18 19 20 |
# File 'lib/getaround_utils/utils/health_check_file.rb', line 15 def initialize(name) raise ArgumentError, "Expected name as String, got: #{name.inspect}" if !name.is_a?(String) || name.empty? @base_path = root_path.join('tmp', name) @path = @base_path.join(FILE_NAME) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/getaround_utils/utils/health_check_file.rb', line 13 def path @path end |
Instance Method Details
#create ⇒ Object
22 23 24 25 |
# File 'lib/getaround_utils/utils/health_check_file.rb', line 22 def create FileUtils.mkdir_p(@base_path) FileUtils.touch(@path) end |
#delete ⇒ Object
27 28 29 |
# File 'lib/getaround_utils/utils/health_check_file.rb', line 27 def delete FileUtils.rm_f(@path) end |
#exists? ⇒ Boolean
31 32 33 |
# File 'lib/getaround_utils/utils/health_check_file.rb', line 31 def exists? File.exist?(@path) end |