Class: StandardLedger::Projector::TriggerDsl
- Inherits:
-
Object
- Object
- StandardLedger::Projector::TriggerDsl
- Defined in:
- lib/standard_ledger/projector.rb
Overview
Internal collector for the ‘:trigger`-mode block-DSL form. Captures the `rebuild_sql “…”` clause’s SQL string. The trigger itself is owned by the host (created in a Rails migration); the gem only records this rebuild SQL so ‘StandardLedger.rebuild!` can recompute the projection from the log when invoked. Like `:sql` mode, the SQL must be expressible as a single statement with `:target_id` bound from each target’s id at rebuild time.
Instance Attribute Summary collapse
-
#rebuild_sql_text ⇒ Object
readonly
Returns the value of attribute rebuild_sql_text.
Instance Method Summary collapse
Instance Attribute Details
#rebuild_sql_text ⇒ Object (readonly)
Returns the value of attribute rebuild_sql_text.
623 624 625 |
# File 'lib/standard_ledger/projector.rb', line 623 def rebuild_sql_text @rebuild_sql_text end |
Instance Method Details
#rebuild_sql(sql) ⇒ Object
625 626 627 628 629 630 631 632 633 634 635 |
# File 'lib/standard_ledger/projector.rb', line 625 def rebuild_sql(sql) unless sql.is_a?(String) raise ArgumentError, "rebuild_sql requires a SQL string; got #{sql.class}" end unless @rebuild_sql_text.nil? raise ArgumentError, "rebuild_sql called more than once in the same projects_onto block; " \ ":trigger mode supports exactly one rebuild_sql clause per projection" end @rebuild_sql_text = sql end |