Class: ActiveRecord::ConnectionAdapters::NullDBAdapter::EmptyResult

Inherits:
Array
  • Object
show all
Defined in:
lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#column_typesObject (readonly)

Returns the value of attribute column_types


4
5
6
# File 'lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb', line 4

def column_types
  @column_types
end

Instance Method Details

#>(num) ⇒ Object


32
33
34
# File 'lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb', line 32

def >(num)
  rows.size > num
end

#bind_column_meta(columns) ⇒ Object


6
7
8
9
10
11
12
13
14
# File 'lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb', line 6

def bind_column_meta(columns)
  @columns = columns
  return if columns.empty?

  @column_types = columns.reduce({}) do |ctypes, col|
    ctypes[col.name] = ActiveRecord::Type.lookup(col.type)
    ctypes
  end      
end

#cast_values(type_overrides = nil) ⇒ Object


24
25
26
# File 'lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb', line 24

def cast_values(type_overrides = nil)
  rows
end

#columnsObject


16
17
18
# File 'lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb', line 16

def columns
  @columns ||= []
end

#includes_column?(name) ⇒ Boolean

Returns:

  • (Boolean)

36
37
38
# File 'lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb', line 36

def includes_column?(name)
  false
end

#rowsObject


28
29
30
# File 'lib/active_record/connection_adapters/nulldb_adapter/empty_result.rb', line 28

def rows
  []
end