Class: Stupidedi::Values::AbstractVal
- Inherits:
-
Object
- Object
- Stupidedi::Values::AbstractVal
- Defined in:
- lib/stupidedi/values/abstract_val.rb
Direct Known Subclasses
AbstractElementVal, FunctionalGroupVal, InterchangeVal, InvalidEnvelopeVal, InvalidSegmentVal, LoopVal, SegmentVal, TableVal, TransactionSetVal, TransmissionVal
Instance Method Summary collapse
-
#blank? ⇒ Boolean
Is the element not present?.
-
#characters(result = Sets.absolute([], Reader::C_BYTES.split(//))) ⇒ AbstractSet<String>
Returns the set of characters that are used as data in this subtree, not including the separator (delimiter) elements found in the ISA segment.
-
#component? ⇒ Boolean
Is this a component SimpleElementVal?.
-
#composite? ⇒ Boolean
Is this a CompositeElementVal?.
- #definition ⇒ SimpleElementDef, ...
- #descriptor ⇒ String
-
#element? ⇒ Boolean
Is this a AbstractElementVal?.
- #empty? ⇒ Boolean
-
#functional_group? ⇒ Boolean
Is this an FunctionalGroupVal?.
-
#interchange? ⇒ Boolean
Is this an InterchangeVal?.
- #invalid? ⇒ Boolean
- #leaf? ⇒ Boolean abstract
-
#loop? ⇒ Boolean
Is this a LoopVal?.
-
#present? ⇒ Boolean
Is the element not blank?.
-
#repeated? ⇒ Boolean
Is this a repeated AbstractElementVal?.
-
#segment? ⇒ Boolean
Is this a SegmentVal or InvalidSegmentVal?.
-
#separator? ⇒ Boolean
Is this a simple element that represents a separator (delimiter)? For instance, ISA16 represents the repetition separator in version 00501.
-
#simple? ⇒ Boolean
Is this a non-component SimpleElementVal?.
-
#size ⇒ Integer
Number of segments in this subtree.
-
#table? ⇒ Boolean
Is this a TableVal?.
-
#transaction_set? ⇒ Boolean
Is this an TransactionSetVal?.
-
#transmission? ⇒ Boolean
Is this a TransmissionVal?.
-
#valid? ⇒ Boolean
True except for InvalidSegmentVal and AbstractElementVal values that could not be parsed -- "abc" in a numeric field, for example.
Methods included from Color
Methods included from Inspect
Instance Method Details
#blank? ⇒ Boolean
Is the element not present?
46 47 48 |
# File 'lib/stupidedi/values/abstract_val.rb', line 46 def blank? empty? end |
#characters(result = Sets.absolute([], Reader::C_BYTES.split(//))) ⇒ AbstractSet<String>
Returns the set of characters that are used as data in this subtree, not including the separator (delimiter) elements found in the ISA segment.
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/stupidedi/values/abstract_val.rb', line 120 def characters(result = Sets.absolute([], Reader::C_BYTES.split(//))) if leaf? if present? and not separator? result | to_x12.split(//) else result end else children.inject(result){|r,c| c.characters(r) } end end |
#component? ⇒ Boolean
Is this a component SimpleElementVal?
96 97 98 |
# File 'lib/stupidedi/values/abstract_val.rb', line 96 def component? false end |
#composite? ⇒ Boolean
Is this a CompositeElementVal?
91 92 93 |
# File 'lib/stupidedi/values/abstract_val.rb', line 91 def composite? false end |
#definition ⇒ SimpleElementDef, ...
11 |
# File 'lib/stupidedi/values/abstract_val.rb', line 11 abstract :definition |
#descriptor ⇒ String
14 |
# File 'lib/stupidedi/values/abstract_val.rb', line 14 abstract :descriptor |
#element? ⇒ Boolean
Is this a Stupidedi::Values::AbstractElementVal?
86 87 88 |
# File 'lib/stupidedi/values/abstract_val.rb', line 86 def element? false end |
#empty? ⇒ Boolean
17 18 19 |
# File 'lib/stupidedi/values/abstract_val.rb', line 17 def empty? @children.all?(&:empty?) end |
#functional_group? ⇒ Boolean
Is this an FunctionalGroupVal?
61 62 63 |
# File 'lib/stupidedi/values/abstract_val.rb', line 61 def functional_group? false end |
#interchange? ⇒ Boolean
Is this an InterchangeVal?
56 57 58 |
# File 'lib/stupidedi/values/abstract_val.rb', line 56 def interchange? false end |
#invalid? ⇒ Boolean
36 37 38 |
# File 'lib/stupidedi/values/abstract_val.rb', line 36 def invalid? not valid? end |
#leaf? ⇒ Boolean
21 |
# File 'lib/stupidedi/values/abstract_val.rb', line 21 abstract :leaf? |
#loop? ⇒ Boolean
Is this a LoopVal?
76 77 78 |
# File 'lib/stupidedi/values/abstract_val.rb', line 76 def loop? false end |
#present? ⇒ Boolean
Is the element not blank?
41 42 43 |
# File 'lib/stupidedi/values/abstract_val.rb', line 41 def present? not empty? end |
#repeated? ⇒ Boolean
Is this a repeated Stupidedi::Values::AbstractElementVal?
101 102 103 |
# File 'lib/stupidedi/values/abstract_val.rb', line 101 def repeated? false end |
#segment? ⇒ Boolean
Is this a SegmentVal or InvalidSegmentVal?
81 82 83 |
# File 'lib/stupidedi/values/abstract_val.rb', line 81 def segment? false end |
#separator? ⇒ Boolean
Is this a simple element that represents a separator (delimiter)? For instance, ISA16 represents the repetition separator in version 00501.
112 113 114 |
# File 'lib/stupidedi/values/abstract_val.rb', line 112 def separator? false end |
#simple? ⇒ Boolean
Is this a non-component SimpleElementVal?
106 107 108 |
# File 'lib/stupidedi/values/abstract_val.rb', line 106 def simple? false end |
#size ⇒ Integer
Number of segments in this subtree
26 27 28 |
# File 'lib/stupidedi/values/abstract_val.rb', line 26 def size @children.sum(&:size) end |
#table? ⇒ Boolean
Is this a TableVal?
71 72 73 |
# File 'lib/stupidedi/values/abstract_val.rb', line 71 def table? false end |
#transaction_set? ⇒ Boolean
Is this an TransactionSetVal?
66 67 68 |
# File 'lib/stupidedi/values/abstract_val.rb', line 66 def transaction_set? false end |
#transmission? ⇒ Boolean
Is this a TransmissionVal?
51 52 53 |
# File 'lib/stupidedi/values/abstract_val.rb', line 51 def transmission? false end |
#valid? ⇒ Boolean
True except for InvalidSegmentVal and Stupidedi::Values::AbstractElementVal values that could not be parsed -- "abc" in a numeric field, for example.
32 33 34 |
# File 'lib/stupidedi/values/abstract_val.rb', line 32 def valid? true end |