Class: Bosh::Director::TaskResultFile

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/task_result_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ TaskResultFile

Returns a new instance of TaskResultFile.



3
4
5
6
# File 'lib/bosh/director/task_result_file.rb', line 3

def initialize(file_name)
  @file = File.open(file_name, 'w')
  @lock = Mutex.new
end

Instance Method Details

#write(result) ⇒ Object



8
9
10
11
12
13
# File 'lib/bosh/director/task_result_file.rb', line 8

def write(result)
  @lock.synchronize do
    @file.write(result)
    @file.flush
  end
end