Class: Spree::Address::StateValidator
- Inherits:
-
Object
- Object
- Spree::Address::StateValidator
- Defined in:
- app/models/spree/address/state_validator.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
Instance Method Summary collapse
-
#initialize(address) ⇒ StateValidator
constructor
A new instance of StateValidator.
- #perform ⇒ Object
Constructor Details
#initialize(address) ⇒ StateValidator
Returns a new instance of StateValidator.
8 9 10 |
# File 'app/models/spree/address/state_validator.rb', line 8 def initialize(address) @address = address end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
5 6 7 |
# File 'app/models/spree/address/state_validator.rb', line 5 def address @address end |
Instance Method Details
#perform ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/spree/address/state_validator.rb', line 12 def perform return unless state_required? if country.present? normalize_state if state.present? normalize_state_name if state_name.present? end validate_not_blank validate_matches_country end |