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.
327 328 329 |
# File 'lib/libsql.rb', line 327 def initialize(inner) @inner = inner end |
Instance Method Details
#close ⇒ Object
361 362 363 364 365 366 |
# File 'lib/libsql.rb', line 361 def close raise ClosedException if closed? @inner.deinit @inner = nil end |
#closed? ⇒ Boolean
368 369 370 |
# File 'lib/libsql.rb', line 368 def closed? @inner.nil? end |
#column_count ⇒ Object
331 332 333 334 335 |
# File 'lib/libsql.rb', line 331 def column_count raise ClosedException if closed? @inner.length end |
#columns ⇒ Object
337 338 339 340 341 |
# File 'lib/libsql.rb', line 337 def columns raise ClosedException if closed? (0...column_count).map { |i| @inner.name_at(i).to_s } end |
#each ⇒ Object
354 355 356 357 358 359 |
# File 'lib/libsql.rb', line 354 def each while (row = self.next) yield row row.close end end |
#next ⇒ Object
347 348 349 350 351 352 |
# File 'lib/libsql.rb', line 347 def next raise ClosedException if closed? row = @inner.next Row.new row unless row.empty? end |
#to_a ⇒ Object
343 344 345 |
# File 'lib/libsql.rb', line 343 def to_a map(&:to_h) end |