Class: Libsql::Rows
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #column_count ⇒ Object
- #columns ⇒ Object
- #each ⇒ Object
-
#initialize(inner) ⇒ Rows
constructor
A new instance of Rows.
- #next ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(inner) ⇒ Rows
Returns a new instance of Rows.
330 331 332 |
# File 'lib/libsql.rb', line 330 def initialize(inner) @inner = inner end |
Instance Method Details
#close ⇒ Object
364 365 366 367 368 369 |
# File 'lib/libsql.rb', line 364 def close raise ClosedException if closed? @inner.deinit @inner = nil end |
#closed? ⇒ Boolean
371 372 373 |
# File 'lib/libsql.rb', line 371 def closed? @inner.nil? end |
#column_count ⇒ Object
334 335 336 337 338 |
# File 'lib/libsql.rb', line 334 def column_count raise ClosedException if closed? @inner.column_count end |
#columns ⇒ Object
340 341 342 343 344 |
# File 'lib/libsql.rb', line 340 def columns raise ClosedException if closed? (0...column_count).map { |i| @inner.name_at(i).to_s } end |
#each ⇒ Object
357 358 359 360 361 362 |
# File 'lib/libsql.rb', line 357 def each while (row = self.next) yield row row.close end end |
#next ⇒ Object
350 351 352 353 354 355 |
# File 'lib/libsql.rb', line 350 def next raise ClosedException if closed? row = @inner.next Row.new row unless row.empty? end |
#to_a ⇒ Object
346 347 348 |
# File 'lib/libsql.rb', line 346 def to_a map(&:to_h) end |