Class: Stupidedi::Schema::ElementReq
- Inherits:
-
Object
- Object
- 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)
-
#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.
26 27 28 29 |
# File 'lib/stupidedi/schema/element_req.rb', line 26 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
37 38 39 |
# File 'lib/stupidedi/schema/element_req.rb', line 37 def forbidden? @forbidden end |
#inspect ⇒ String
52 53 54 |
# File 'lib/stupidedi/schema/element_req.rb', line 52 def inspect @to_s end |
#optional? ⇒ Boolean
True if the element's presence is required conditionally
42 43 44 |
# File 'lib/stupidedi/schema/element_req.rb', line 42 def optional? not (@required or @forbidden) end |
#pretty_print(q)
This method returns an undefined value.
47 48 49 |
# File 'lib/stupidedi/schema/element_req.rb', line 47 def pretty_print(q) q.text @to_s end |
#required? ⇒ Boolean
True if the element's presence is unconditionally required
32 33 34 |
# File 'lib/stupidedi/schema/element_req.rb', line 32 def required? @required end |