Class: Imparcial::Driver::Row
- Inherits:
-
Object
- Object
- Imparcial::Driver::Row
- 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
-
#name ⇒ Object
(also: #column_name)
Returns the value of attribute name.
-
#value ⇒ Object
(also: #column_value)
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(column_name, column_value) ⇒ Row
constructor
A new instance of Row.
- #to_s ⇒ Object
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
#name ⇒ Object 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 |
#value ⇒ Object 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_s ⇒ Object
86 87 88 89 90 |
# File 'lib/imparcial/driver/abstract/result.rb', line 86 def to_s @value end |