Module: Hecks::Bluebook::Behaviour::ReadModel
- Included in:
- ReadModel
- Defined in:
- lib/hecks/bluebook/behaviour/read_model.rb
Overview
WHAT A READ MODEL DOES. Its declared half is the gathered heads and the query shape; these are readings taken off them.
Instance Method Summary collapse
-
#count? ⇒ Boolean
!!rather than a bare@count— the DSL/reconstruction boundary (ReadModel#initialize) already normalises totrue/nil, so this is belt and braces against a future caller constructing a ReadModel by hand withcount: false. -
#filtered_head_name ⇒ Object
WHICH GATHERED HEAD THE FILTERING APPLIES TO, so the read-model interpreter can ask this directly rather than re-deriving or re-checking it.
- #group_by_fields ⇒ Object
- #query_name ⇒ Object
Instance Method Details
#count? ⇒ Boolean
!! rather than a bare @count — the DSL/reconstruction
boundary (ReadModel#initialize) already normalises to
true/nil, so this is belt and braces against a future
caller constructing a ReadModel by hand with count: false.
13 |
# File 'lib/hecks/bluebook/behaviour/read_model.rb', line 13 def count? = !!@count |
#filtered_head_name ⇒ Object
WHICH GATHERED HEAD THE FILTERING APPLIES TO, so the read-model interpreter can ask this directly rather than re-deriving or re-checking it.
20 21 22 23 24 25 |
# File 'lib/hecks/bluebook/behaviour/read_model.rb', line 20 def filtered_head_name return nil unless wheres.any? || order_by || limit || offset || &.tenant || @group_by.any? || count? || @median_field @aggregate_heads.find { |head| head[:many] }&.fetch(:as) end |
#group_by_fields ⇒ Object
7 |
# File 'lib/hecks/bluebook/behaviour/read_model.rb', line 7 def group_by_fields = @group_by.map { |row| row[:field].to_sym } |