Class: ESS::Validation::CurrMandatoryIfValueGT0

Inherits:
Object
  • Object
show all
Defined in:
lib/ess/validation.rb

Instance Method Summary collapse

Instance Method Details

#validate(price_tag) ⇒ Object



581
582
583
584
585
586
587
# File 'lib/ess/validation.rb', line 581

def validate price_tag
  if price_tag.value.text!.to_i != 0
    if price_tag.currency.text! == ""
      raise InvalidValueError, "the <currency> element of a price item cannot be empty if <value> is not 0"
    end
  end
end