Module: Sqlx::Row
- Included in:
- Base
- Defined in:
- runtime/sqlx/row.rb,
runtime/sqlx/row.rbs
Overview
The row-object layer — the instance side of hydration: the generic constructor and the read seam every literal accessor routes through. Included into Base so models inherit the instance methods; a hand-written model initialize still overrides.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ Object
the generic row constructor behind the hash-backed accessor path: a model whose readers come from its literal accessor loop needs no hand-written initialize.
-
#read_attribute(name) ⇒ Object
the read seam of the hash-backed accessor adapter: the model's literal accessor loop routes every column read through this one method, so the storage behind the readers is core-owned and free to change without touching models.
Instance Method Details
#initialize(**attrs) ⇒ Object
the generic row constructor behind the hash-backed accessor path: a model
whose readers come from its literal accessor loop needs no hand-written
initialize. Keys are checked against only_columns at this entry so a
typo'd keyword raises here instead of reading as a silent nil later;
missing keys are allowed — an unselected column reads as nil. A model that
hand-writes initialize simply overrides this.
21 |
# File 'runtime/sqlx/row.rb', line 21
def initialize: (**untyped attrs) -> void
|
#read_attribute(name) ⇒ Object
the read seam of the hash-backed accessor adapter: the model's literal accessor loop routes every column read through this one method, so the storage behind the readers is core-owned and free to change without touching models. A missing key answers nil — an unselected column and a NULL value read the same way.
44 |
# File 'runtime/sqlx/row.rb', line 44
def read_attribute: (Symbol | String name) -> untyped
|