Class: Israeli::PostalCodeResult
Overview
Result object for postal code validation with formatting.
Instance Attribute Summary
Attributes inherited from Result
#normalized, #original, #reason
Instance Method Summary collapse
-
#formatted(style: :compact) ⇒ String?
Format the postal code.
Methods inherited from Result
#initialize, #invalid?, #to_s, #valid?, #value
Constructor Details
This class inherits a constructor from Israeli::Result
Instance Method Details
#formatted(style: :compact) ⇒ String?
Format the postal code.
114 115 116 117 118 |
# File 'lib/israeli/result.rb', line 114 def formatted(style: :compact) return nil unless valid? Validators::PostalCode.format(@normalized, style: style) end |