Class: ActiveRecord::ConnectionAdapters::AuroraServerless::Mysql2::Result

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/active_record/connection_adapters/aurora_serverless/mysql2/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Result



13
14
15
# File 'lib/active_record/connection_adapters/aurora_serverless/mysql2/result.rb', line 13

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



11
12
13
# File 'lib/active_record/connection_adapters/aurora_serverless/mysql2/result.rb', line 11

def response
  @response
end

Instance Method Details

#each(**kwargs) ⇒ Object



28
29
30
31
# File 'lib/active_record/connection_adapters/aurora_serverless/mysql2/result.rb', line 28

def each(**kwargs)
  eobj = each_object(kwargs)
  block_given? ? eobj.each { |r| yield(r) } : eobj
end

#fieldsObject



17
18
19
20
21
22
# File 'lib/active_record/connection_adapters/aurora_serverless/mysql2/result.rb', line 17

def fields
  @fields ||= begin
    md = @response.
    md ? md.map(&:label) : []
  end
end

#to_aObject



24
25
26
# File 'lib/active_record/connection_adapters/aurora_serverless/mysql2/result.rb', line 24

def to_a
  as_array
end