Class: Statecraft::Mounting::Builder
- Inherits:
-
Object
- Object
- Statecraft::Mounting::Builder
- Defined in:
- lib/statecraft/mounting.rb
Overview
Performs the mounting steps in threshold order. Every check here works on class hierarchies only — never on the schema and never on a live connection, so mounting is safe at load time.
Instance Method Summary collapse
-
#initialize(model:, machine_class:, log:, column:, changed_at:, touch:, helpers:, scopes:) ⇒ Builder
constructor
A new instance of Builder.
- #mount ⇒ Object
Constructor Details
#initialize(model:, machine_class:, log:, column:, changed_at:, touch:, helpers:, scopes:) ⇒ Builder
Returns a new instance of Builder.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/statecraft/mounting.rb', line 30 def initialize(model:, machine_class:, log:, column:, changed_at:, touch:, helpers:, scopes:) @model = model @machine_class = machine_class @log_option = log @column = column @changed_at = changed_at @touch = touch @helpers = helpers @scopes = scopes end |
Instance Method Details
#mount ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/statecraft/mounting.rb', line 41 def mount assert_not_mounted assert_single_column_primary_key log_class = resolve_log_class assert_shared_connection_class(log_class) graph = machine_class.finalize! assert_no_verb_conflicts(graph) assert_no_scope_conflicts(graph) configuration = build_configuration(log_class) store_configuration(configuration) define_scopes(graph, configuration) define_reading_surface model.include(Pipeline::Surface) model.include(Introspection) define_verbs(graph) if @helpers configuration end |