Class: AdLocalize::Interactors::MergeWordings

Inherits:
Object
  • Object
show all
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]
DEFAULT_POLICY =
KEEP_MERGE_POLICY

Instance Method Summary collapse

Instance Method Details

#call(wordings:, merge_policy:) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/ad_localize/interactors/merge_wordings.rb', line 10

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