class Eddy::Elements::E116
### Element Summary:
-
Id: 116
-
Name: Postal Code
-
Type: ID
-
Min/Max: 3/15
-
Description: Code defining international postal zone code excluding punctuation and blanks (zip code for United States)
### Notes:
-
There are too many valid values for this, so it uses a regular expression instead of a codelist.
-
FIXME: Implement that ☝
-
See [Segment and
Data
Element Definitions - X12 RFI](www.x12.org/rfis/Segment%20and%20Data%20Element%20Definitions.pdf)
Public Class Methods
new(val: nil, req: nil, ref: nil)
click to toggle source
@param val [String] (nil) @param req [String] (nil) @param ref [String] (nil) @return [void]
Calls superclass method
Eddy::Models::Element::AN::new
# File lib/definitions/elements/manual/116.postal_code.rb, line 22 def initialize(val: nil, req: nil, ref: nil) @id = "116" @name = "Postal Code" @description = "Code defining international postal zone code excluding punctuation and blanks (zip code for United States)" super( min: 3, max: 15, req: req, ref: ref, val: val, ) end
Public Instance Methods
pattern()
click to toggle source
Matches any valid US zip code.
@return [Regexp]
# File lib/definitions/elements/manual/116.postal_code.rb, line 38 def pattern return /^[0-9]{5}(?:-[0-9]{4})?$/ end