Module: Cassie::Statements::Results::Querying
- Extended by:
- ActiveSupport::Concern
- Included in:
- CursoredResult, PeekingResult, QueryResult
- Defined in:
- lib/cassie/statements/execution/results/querying.rb
Instance Method Summary collapse
- #after_initialize(opts) ⇒ Object
-
#each(&block) ⇒ Object
Deserialize each row into domain objects.
- #first! ⇒ Object
- #success? ⇒ Boolean
Instance Method Details
#after_initialize(opts) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/cassie/statements/execution/results/querying.rb', line 21 def after_initialize(opts) super @each_deserializer = opts[:each_deserializer] @deserializer = opts[:deserializer] ensure_deserialization end |
#each(&block) ⇒ Object
Deserialize each row into domain objects
note: __object__.each is aliased as rows and each_row.
32 33 34 35 36 37 38 39 |
# File 'lib/cassie/statements/execution/results/querying.rb', line 32 def each(&block) if block_given? records.each(&block) self else records.each end end |
#first! ⇒ Object
41 42 43 |
# File 'lib/cassie/statements/execution/results/querying.rb', line 41 def first! first || (raise Cassie::Statements::RecordNotFound, 'CQL row does not exist') end |
#success? ⇒ Boolean
45 46 47 48 49 50 |
# File 'lib/cassie/statements/execution/results/querying.rb', line 45 def success? # an empty query is still successful return true if __getobj__.empty? super end |