Module: Warren::Callback::ExceptSapio
- Included in:
- ApplicationRecord
- Defined in:
- lib/warren/callback/except_sapio.rb
Overview
Provides Warren broadcasting helpers that exclude records mastered in Sapio.
Including this module adds:
- ClassMethods#broadcast_with_warren_except_sapio for configuring automatic broadcasts after commit.
- #broadcast_except_sapio for manually broadcasting records while applying the Sapio filter.
Records are considered mastered in Sapio when they respond to
mastered_in_sapio? and the predicate returns true.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ void
Extends the including class with the class methods.
Instance Method Summary collapse
-
#broadcast_except_sapio ⇒ void
Broadcasts the record as a Warren full message unless it is mastered in Sapio.
Class Method Details
.included(base) ⇒ void
This method returns an undefined value.
Extends the including class with the class methods.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/warren/callback/except_sapio.rb', line 36 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |
Instance Method Details
#broadcast_except_sapio ⇒ void
This method returns an undefined value.
Broadcasts the record as a Warren full message unless it is mastered in Sapio.
Records that implement mastered_in_sapio? and return true are
ignored.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/warren/callback/except_sapio.rb', line 47 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |