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.


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

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)

39
40
41
# File 'lib/stupidedi/schema/element_req.rb', line 39

def forbidden?
  @forbidden
end

#inspectString

Returns:

  • (String)

54
55
56
# File 'lib/stupidedi/schema/element_req.rb', line 54

def inspect
  @to_s
end

#optional?Boolean

True if the element's presence is required conditionally

Returns:

  • (Boolean)

44
45
46
# File 'lib/stupidedi/schema/element_req.rb', line 44

def optional?
  not (@required or @forbidden)
end

#pretty_print(q)

This method returns an undefined value.


49
50
51
# File 'lib/stupidedi/schema/element_req.rb', line 49

def pretty_print(q)
  q.text @to_s
end

#required?Boolean

True if the element's presence is unconditionally required

Returns:

  • (Boolean)

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

def required?
  @required
end