Class: PromotionalRulesCollection

Inherits:
Array
  • Object
show all
Defined in:
lib/wunder/collections/promotional_rules_collection.rb

Instance Method Summary collapse

Instance Method Details

#find_promotional_rule(rule) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/wunder/collections/promotional_rules_collection.rb', line 2

def find_promotional_rule(rule)
  each do |promotional_rule|
    @promotional_rule = promotional_rule if promotional_rule == rule
  end

  @promotional_rule
end

#validate_promotion_rule_is_uniq(promotional_rule) ⇒ Object



10
11
12
13
# File 'lib/wunder/collections/promotional_rules_collection.rb', line 10

def validate_promotion_rule_is_uniq(promotional_rule)
  err_msg = "DuplicatePromotionalRuleError"
  find_promotional_rule(promotional_rule).nil? ? true : (raise err_msg.to_s)
end