Method: ThreadIO#read
- Defined in:
- lib/thread_io.rb
#read(path) ⇒ Object
this method returns immediately and loads the file in the background
path: the path to the file you want to read.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/thread_io.rb', line 28 def read(path) @ready = false Thread.new do @string = nil @string = IO.read(path) @ready = true nil end nil end |