Class: Libcall::OutputReader
- Inherits:
-
Object
- Object
- Libcall::OutputReader
- Defined in:
- lib/libcall/output_reader.rb
Overview
Handles reading output parameters after FFI calls
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(out_refs) ⇒ OutputReader
constructor
A new instance of OutputReader.
- #read ⇒ Object
Constructor Details
#initialize(out_refs) ⇒ OutputReader
Returns a new instance of OutputReader.
6 7 8 |
# File 'lib/libcall/output_reader.rb', line 6 def initialize(out_refs) @out_refs = out_refs end |
Instance Method Details
#empty? ⇒ Boolean
23 24 25 |
# File 'lib/libcall/output_reader.rb', line 23 def empty? @out_refs.empty? end |
#read ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/libcall/output_reader.rb', line 10 def read @out_refs.map do |ref| case ref[:kind] when :out read_single_output(ref) when :out_array read_array_output(ref) else raise Error, "Unknown out reference kind: #{ref[:kind]}" end end end |