Class: Imparcial::Driver::AbstractResult

Inherits:
Object
  • Object
show all
Defined in:
lib/imparcial/driver/abstract/result.rb

Overview

This class will serve as base for adapter specific result class.

Direct Known Subclasses

MysqlResult, PostgreResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result_specific) ⇒ AbstractResult

Returns a new instance of AbstractResult.



9
10
11
12
13
# File 'lib/imparcial/driver/abstract/result.rb', line 9

def initialize ( result_specific )

  @specific = result_specific

end

Instance Attribute Details

#specificObject (readonly)

Returns the value of attribute specific.



7
8
9
# File 'lib/imparcial/driver/abstract/result.rb', line 7

def specific
  @specific
end

Instance Method Details

#fetchObject

Description

fetch the result.

Raises:



27
28
29
30
31
# File 'lib/imparcial/driver/abstract/result.rb', line 27

def fetch
  
  raise FeatureNotFound
  
end

#fetch_first_rowObject

Description

Fetch the first row. Ignoring others if avaliable.



50
51
52
53
54
55
56
# File 'lib/imparcial/driver/abstract/result.rb', line 50

def fetch_first_row
  
  fetch do |*rows|
    return *rows
  end
  
end

#fetch_in_arrayObject



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/imparcial/driver/abstract/result.rb', line 33

def fetch_in_array
  
  array = []
  
  fetch do |*rows|
  
    array << rows
  
  end

  array
  
end

#rowsObject

Description

get number of rows avaliable.

Raises:



18
19
20
21
22
# File 'lib/imparcial/driver/abstract/result.rb', line 18

def rows

  raise FeatureNotFound

end