Class: Eddy::Elements::E116
- Inherits:
-
Models::Element::AN
- Object
- Models::Element::Base
- Models::Element::AN
- Eddy::Elements::E116
- Defined in:
- lib/definitions/elements/manual/116.postal_code.rb
Overview
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
Instance Attribute Summary
Attributes inherited from Models::Element::Base
#description, #id, #max, #min, #name, #ref, #type
Instance Method Summary collapse
- #initialize(val: nil, req: nil, ref: nil) ⇒ void constructor
-
#pattern ⇒ Regexp
Matches any valid US zip code.
Methods inherited from Models::Element::AN
#process_value, process_value, #value, #value=
Methods inherited from Models::Element::Base
#doc_comment, #process_value, process_value, #req, #req=, #value, #value=
Constructor Details
#initialize(val: nil, req: nil, ref: nil) ⇒ void
22 23 24 25 26 27 28 29 30 31 32 33 |
# 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 |
Instance Method Details
#pattern ⇒ Regexp
Matches any valid US zip code.
38 39 40 |
# File 'lib/definitions/elements/manual/116.postal_code.rb', line 38 def pattern return /^[0-9]{5}(?:-[0-9]{4})?$/ end |