Class: AdLocalize::Requests::MergePolicy
- Inherits:
-
Object
- Object
- AdLocalize::Requests::MergePolicy
- Defined in:
- lib/ad_localize/requests/merge_policy.rb
Constant Summary collapse
- REPLACE_POLICY =
'replace'.freeze
- KEEP_POLICY =
'keep'.freeze
- MERGE_POLICIES =
[KEEP_POLICY, REPLACE_POLICY]
- DEFAULT_POLICY =
KEEP_POLICY
Instance Attribute Summary collapse
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
Instance Method Summary collapse
-
#initialize(policy:) ⇒ MergePolicy
constructor
A new instance of MergePolicy.
- #keep? ⇒ Boolean
- #replace? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(policy:) ⇒ MergePolicy
Returns a new instance of MergePolicy.
11 12 13 |
# File 'lib/ad_localize/requests/merge_policy.rb', line 11 def initialize(policy:) @policy = policy end |
Instance Attribute Details
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
9 10 11 |
# File 'lib/ad_localize/requests/merge_policy.rb', line 9 def policy @policy end |
Instance Method Details
#keep? ⇒ Boolean
15 16 17 |
# File 'lib/ad_localize/requests/merge_policy.rb', line 15 def keep? @policy == KEEP_POLICY end |
#replace? ⇒ Boolean
19 20 21 |
# File 'lib/ad_localize/requests/merge_policy.rb', line 19 def replace? @policy == REPLACE_POLICY end |
#valid? ⇒ Boolean
23 24 25 |
# File 'lib/ad_localize/requests/merge_policy.rb', line 23 def valid? @policy.present? && MERGE_POLICIES.include?(@policy) end |