Class: PgHelper::ValidationHelper
- Inherits:
-
Object
- Object
- PgHelper::ValidationHelper
- Defined in:
- lib/pg_helper/support_classes.rb
Overview
data validation
Class Method Summary collapse
- .require_single_column!(pg_result) ⇒ Object
- .require_single_row!(pg_result) ⇒ Object
- .verify_single_cell!(pg_result) ⇒ Object
Class Method Details
.require_single_column!(pg_result) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/pg_helper/support_classes.rb', line 31 def require_single_column!(pg_result) fail( PgHelperErrorInvalidColumnCount, "expected 1 column, got #{pg_result.nfields}" ) if pg_result.nfields != 1 end |
.require_single_row!(pg_result) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/pg_helper/support_classes.rb', line 24 def require_single_row!(pg_result) fail( PgHelperErrorInvalidRowCount, "expected 1 row, got #{pg_result.ntuples}" ) if pg_result.ntuples != 1 end |
.verify_single_cell!(pg_result) ⇒ Object
38 39 40 41 |
# File 'lib/pg_helper/support_classes.rb', line 38 def verify_single_cell!(pg_result) require_single_row!(pg_result) require_single_column!(pg_result) end |