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.
317 318 319 |
# File 'lib/libsql.rb', line 317 def initialize(inner) @inner = inner end |
Instance Method Details
#close ⇒ Object
351 352 353 354 355 356 |
# File 'lib/libsql.rb', line 351 def close raise ClosedException if closed? @inner.deinit @inner = nil end |
#closed? ⇒ Boolean
358 359 360 |
# File 'lib/libsql.rb', line 358 def closed? @inner.nil? end |
#column_count ⇒ Object
321 322 323 324 325 |
# File 'lib/libsql.rb', line 321 def column_count raise ClosedException if closed? @inner.length end |
#columns ⇒ Object
327 328 329 330 331 |
# File 'lib/libsql.rb', line 327 def columns raise ClosedException if closed? (0...column_count).map { |i| @inner.name_at(i).to_s } end |
#each ⇒ Object
344 345 346 347 348 349 |
# File 'lib/libsql.rb', line 344 def each while (row = self.next) yield row row.close end end |
#next ⇒ Object
337 338 339 340 341 342 |
# File 'lib/libsql.rb', line 337 def next raise ClosedException if closed? row = @inner.next Row.new row unless row.empty? end |
#to_a ⇒ Object
333 334 335 |
# File 'lib/libsql.rb', line 333 def to_a map(&:to_h) end |