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.


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

Returns:

  • (Boolean)

37
38
39
# File 'lib/stupidedi/schema/element_req.rb', line 37

def forbidden?
  @forbidden
end

#inspectString

Returns:

  • (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

Returns:

  • (Boolean)

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

Returns:

  • (Boolean)

32
33
34
# File 'lib/stupidedi/schema/element_req.rb', line 32

def required?
  @required
end