Class: IPVSLitmus::StatusFile
- Inherits:
-
Object
- Object
- IPVSLitmus::StatusFile
- Defined in:
- lib/ipvs_litmus/status_file.rb
Instance Method Summary collapse
- #content ⇒ Object
- #create(reason) ⇒ Object
- #delete ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(*filenames) ⇒ StatusFile
constructor
A new instance of StatusFile.
Constructor Details
#initialize(*filenames) ⇒ StatusFile
Returns a new instance of StatusFile.
3 4 5 |
# File 'lib/ipvs_litmus/status_file.rb', line 3 def initialize(*filenames) @path = File.join(IPVSLitmus.config_dir, *filenames) end |
Instance Method Details
#content ⇒ Object
7 8 9 |
# File 'lib/ipvs_litmus/status_file.rb', line 7 def content File.read(@path).chomp end |
#create(reason) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ipvs_litmus/status_file.rb', line 11 def create(reason) FileUtils.mkdir_p(File.dirname(@path)) File.open(@path, 'w') do |file| file.puts(reason) end end |
#delete ⇒ Object
18 19 20 |
# File 'lib/ipvs_litmus/status_file.rb', line 18 def delete FileUtils.rm(@path) end |
#exists? ⇒ Boolean
22 23 24 |
# File 'lib/ipvs_litmus/status_file.rb', line 22 def exists? File.exists?(@path) end |