Class: Dizby::IOBarrier

Inherits:
Object
  • Object
show all
Defined in:
lib/dizby/utility/io_barrier.rb

Instance Method Summary collapse

Constructor Details

#initialize(var) ⇒ IOBarrier


4
5
6
7
# File 'lib/dizby/utility/io_barrier.rb', line 4

def initialize(var)
  @var = var
  @orig = var.dup
end

Instance Method Details

#allow


13
14
15
16
# File 'lib/dizby/utility/io_barrier.rb', line 13

def allow
  @var.reopen(@orig)
  @var.sync = true
end

#block


9
10
11
# File 'lib/dizby/utility/io_barrier.rb', line 9

def block
  @var.reopen(File::NULL)
end