Class: AdLocalize::Interactors::MergeWordings
- Inherits:
-
Object
- Object
- AdLocalize::Interactors::MergeWordings
- Defined in:
- lib/ad_localize/interactors/merge_wordings.rb
Constant Summary collapse
- REPLACE_MERGE_POLICY =
'replace'.freeze
- KEEP_MERGE_POLICY =
'keep'.freeze
- MERGE_POLICIES =
[KEEP_MERGE_POLICY, REPLACE_MERGE_POLICY]
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.valid_policy?(policy:) ⇒ Boolean
8 9 10 |
# File 'lib/ad_localize/interactors/merge_wordings.rb', line 8 def self.valid_policy?(policy:) MERGE_POLICIES.include?(policy) end |
Instance Method Details
#call(wordings:, merge_policy:) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/ad_localize/interactors/merge_wordings.rb', line 12 def call(wordings:, merge_policy:) if wordings.size == 1 wordings.first elsif wordings.size > 1 LOGGER.debug("Merge wordings before processing") merge_many(wordings: wordings, merge_policy: merge_policy) end end |