Class: Filterable::DeclarationsValidator
- Inherits:
-
Object
- Object
- Filterable::DeclarationsValidator
- Defined in:
- lib/filterable/declarations_validator.rb
Overview
Checks a model's declarations against its actual columns and scopes, so a typo in a declaration — a silent no-op at runtime by design — can be caught by a spec:
expect(MovementDetail.filterable_declarations).to be_valid
Never used by the engine at runtime: filtering stays a silent no-op on unknown attributes.
Constant Summary collapse
- KINDS =
The column-backed declaration DSLs to check, each exposing
<kind>_attribute_nameson the model. A kind the model does not respond to is skipped. %i[datable sortable equatable rangeable matchable].freeze
- SCOPE_KINDS =
The scope-backed declaration DSLs to check, each exposing
<kind>_scope_nameson the model. A kind the model does not respond to is skipped. %i[scopable togglable].freeze
- ATTACHMENT_KINDS =
The attachment-backed declaration DSLs to check, each exposing
<kind>_attachment_nameson the model. A kind the model does not respond to is skipped. %i[attachable].freeze
Instance Method Summary collapse
-
#errors ⇒ Array<String>
The declarations pointing to unknown columns or scopes, as human-readable messages.
-
#initialize(model) ⇒ DeclarationsValidator
constructor
Builds a validator over one model's declarations.
-
#valid? ⇒ Boolean
Whether every declaration maps onto an existing column or scope.
Constructor Details
#initialize(model) ⇒ DeclarationsValidator
Builds a validator over one model's declarations.
Instance Method Details
#errors ⇒ Array<String>
The declarations pointing to unknown columns or scopes, as human-readable messages.
#valid? ⇒ Boolean
Whether every declaration maps onto an existing column or scope.