Class: Veritas::Adapter::DataObjects

Inherits:
Object
  • Object
show all
Includes:
Immutable
Defined in:
lib/veritas/adapter/data_objects.rb,
lib/veritas/adapter/data_objects/version.rb,
lib/veritas/adapter/data_objects/statement.rb

Overview

An adapter wrapping a DataObjects connection

Defined Under Namespace

Classes: Statement

Constant Summary collapse

VERSION =
'0.0.7'

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a DataObjects adapter

Parameters:

  • uri (String)


21
22
23
# File 'lib/veritas/adapter/data_objects.rb', line 21

def initialize(uri)
  @uri = uri
end

Instance Method Details

#read(relation) {|row| ... } ⇒ self

Read the results from the SQL representation of the relation

Examples:

adapter.read(relation) { |row| ... }

Parameters:

Yields:

  • (row)

Yield Parameters:

  • row (Array)

    each row in the results

Returns:

  • (self)


40
41
42
43
44
45
46
47
# File 'lib/veritas/adapter/data_objects.rb', line 40

def read(relation)
  return to_enum(__method__, relation) unless block_given?
  connection = ::DataObjects::Connection.new(@uri)
  Statement.new(connection, relation).each { |row| yield row }
  self
ensure
  connection.close if connection
end