Class: AVCapture::ImagePromise
- Inherits:
-
Object
- Object
- AVCapture::ImagePromise
- Defined in:
- lib/av_capture.rb
Instance Method Summary collapse
- #data ⇒ Object (also: #read)
-
#initialize(io) ⇒ ImagePromise
constructor
A new instance of ImagePromise.
- #to_io ⇒ Object
Constructor Details
#initialize(io) ⇒ ImagePromise
Returns a new instance of ImagePromise.
18 19 20 21 22 |
# File 'lib/av_capture.rb', line 18 def initialize io @io = io @data = nil @mutex = Mutex.new end |
Instance Method Details
#data ⇒ Object Also known as: read
26 27 28 29 30 |
# File 'lib/av_capture.rb', line 26 def data @data || @mutex.synchronize do @data ||= @io.read.tap { @io.close } end end |
#to_io ⇒ Object
24 |
# File 'lib/av_capture.rb', line 24 def to_io; @io; end |