Class: Stupidedi::Schema::ElementReq

Inherits:
Object
  • Object
show all
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

See Also:

  • B.1.1.3.9 Condition Designator
  • 2.2.1 Industry Usage

Instance Method Summary collapse

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

Returns:

  • (Boolean)


35
36
37
# File 'lib/stupidedi/schema/element_req.rb', line 35

def forbidden?
  @forbidden
end

#inspectString

Returns:



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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


30
31
32
# File 'lib/stupidedi/schema/element_req.rb', line 30

def required?
  @required
end