Class: Rx::Check::FileSystemCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/rx/check/file_system_check.rb

Constant Summary collapse

FILENAME =
"rx".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "fs", timeout = 0) ⇒ FileSystemCheck

Returns a new instance of FileSystemCheck.



8
9
10
11
# File 'lib/rx/check/file_system_check.rb', line 8

def initialize(name = "fs", timeout = 0)
  @name = name
  @timeout = 0
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/rx/check/file_system_check.rb', line 6

def name
  @name
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



6
7
8
# File 'lib/rx/check/file_system_check.rb', line 6

def timeout
  @timeout
end

Instance Method Details

#checkObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/rx/check/file_system_check.rb', line 13

def check
  Result.from(name) do
    Timeout::timeout(timeout) do
      !!Tempfile.open(FILENAME) do |f|
        f.write("ok")
        f.flush
      end
    end
  end
end