Class: Daru::IO::SqlDataSource::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/daru/io/sql_data_source.rb

Instance Method Summary collapse

Constructor Details

#initialize(conn, query) ⇒ Adapter

Returns a new instance of Adapter.



6
7
8
9
# File 'lib/daru/io/sql_data_source.rb', line 6

def initialize(conn, query)
  @conn = conn
  @query = query
end

Instance Method Details

#result_hashObject



11
12
13
14
15
16
# File 'lib/daru/io/sql_data_source.rb', line 11

def result_hash
  column_names
    .map(&:to_sym)
    .zip(rows.transpose)
    .to_h
end