Class: Stupidedi::Schema::ElementReq
- Defined in:
- lib/stupidedi/schema/element_req.rb
Overview
The 5010 X12 “condition designator”s include
M - Mandatory
O - Optional
X - Relational
Where “Relational” indicates this element is subject to relational conditions between two or more elements (encoded as a SyntaxNote)
The “Implementation Usage” from the 5010 HIPAA implementation guides have three descriptors:
REQUIRED
NOT USED
SITUATIONAL
Instance Method Summary collapse
-
#forbidden? ⇒ Boolean
True if the element’s presence is unconditionally forbidden.
-
#initialize(required, forbidden, to_s) ⇒ ElementReq
constructor
A new instance of ElementReq.
- #inspect ⇒ String
-
#optional? ⇒ Boolean
True if the element’s presence is required conditionally.
- #pretty_print(q) ⇒ void
-
#required? ⇒ Boolean
True if the element’s presence is unconditionally required.
Constructor Details
#initialize(required, forbidden, to_s) ⇒ ElementReq
Returns a new instance of ElementReq.
24 25 26 27 |
# File 'lib/stupidedi/schema/element_req.rb', line 24 def initialize(required, forbidden, to_s) @required, @forbidden, @to_s = required, forbidden, to_s end |
Instance Method Details
#forbidden? ⇒ Boolean
True if the element’s presence is unconditionally forbidden
35 36 37 |
# File 'lib/stupidedi/schema/element_req.rb', line 35 def forbidden? @forbidden end |
#inspect ⇒ String
50 51 52 |
# File 'lib/stupidedi/schema/element_req.rb', line 50 def inspect @to_s end |
#optional? ⇒ Boolean
True if the element’s presence is required conditionally
40 41 42 |
# File 'lib/stupidedi/schema/element_req.rb', line 40 def optional? not (@required or @forbidden) end |
#pretty_print(q) ⇒ void
This method returns an undefined value.
45 46 47 |
# File 'lib/stupidedi/schema/element_req.rb', line 45 def pretty_print(q) q.text @to_s end |
#required? ⇒ Boolean
True if the element’s presence is unconditionally required
30 31 32 |
# File 'lib/stupidedi/schema/element_req.rb', line 30 def required? @required end |