Class: NWRFC::Table
- Inherits:
-
DataContainer
- Object
- DataContainer
- NWRFC::Table
- Includes:
- Enumerable, DataContainer
- Defined in:
- lib/nwrfc.old.rb,
lib/nwrfc.rb
Overview
Represents a table
Instance Method Summary collapse
-
#[](index) ⇒ Object
Retrieve the row at the given index.
-
#clear ⇒ Object
Delete all rows from (empty) the table.
- #each(&block) ⇒ Object
- #size ⇒ Object
Constructor Details
This class inherits a constructor from NWRFC::DataContainer
Instance Method Details
#[](index) ⇒ Object
Retrieve the row at the given index
373 374 375 376 377 378 379 |
# File 'lib/nwrfc.rb', line 373 def [](index) rc = NWRFCLib.move_to(@handle, index, @error) NWRFC.check_error(@error) if rc > 0 struct_handle = NWRFCLib.get_current_row(@handle, @error) NWRFC.check_error(@error) Structure.new(struct_handle) end |
#clear ⇒ Object
Delete all rows from (empty) the table
367 368 369 370 |
# File 'lib/nwrfc.rb', line 367 def clear rc = delete_all_rows(@handle, @error) NWRFC.check_error(@error) if rc > 0 end |
#each(&block) ⇒ Object
348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/nwrfc.rb', line 348 def each(&block) rc = NWRFCLib.move_to_first_row(@handle, @error) NWRFC.check_error(@error) if rc > 0 size.times do |row| struct_handle = NWRFCLib.get_current_row(@handle, @error) NWRFC.check_error(@error) # CAVEAT: Other calls using the handle require "handle" field # of the RFC_DATA_CONTAINER struct yield Structure.new(struct_handle) end end |