Class: Imparcial::Driver::Row

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

Overview

This class wraps a regular row. Usually, a row will only come with value. Instead, we can also keep the column name. So that, this class can keep track of column name and value.


id | name | price <- column name

1 |  apple | 0.99  <- column value
2 |  lemon | 1.99  <- column value

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AbstractUtil

#quote, #quote_value, #unquote_value

Constructor Details

#initialize(column_name, column_value) ⇒ Row

Returns a new instance of Row.



79
80
81
82
83
84
# File 'lib/imparcial/driver/abstract/result.rb', line 79

def initialize ( column_name, column_value )

  @name  = column_name
  @value = unquote_value(column_value)

end

Instance Attribute Details

#nameObject Also known as: column_name

Returns the value of attribute name.



75
76
77
# File 'lib/imparcial/driver/abstract/result.rb', line 75

def name
  @name
end

#valueObject Also known as: column_value

Returns the value of attribute value.



75
76
77
# File 'lib/imparcial/driver/abstract/result.rb', line 75

def value
  @value
end

Instance Method Details

#to_sObject



86
87
88
89
90
# File 'lib/imparcial/driver/abstract/result.rb', line 86

def to_s
  
  @value
  
end