Class: Stupidedi::Schema::SyntaxNote
- Inherits:
-
Object
- Object
- Stupidedi::Schema::SyntaxNote
- Defined in:
- lib/stupidedi/schema/syntax_note.rb
Overview
The 5010 X12 "condition code"s include P - Paired or Multiple (if one then all) R - Required (at least one) E - Exclusion (no more than one) C - Conditional (if first then all) L - List Conditional (if first than at least one more)
Direct Known Subclasses
Versions::Common::SyntaxNotes::C, Versions::Common::SyntaxNotes::E, Versions::Common::SyntaxNotes::L, Versions::Common::SyntaxNotes::P, Versions::Common::SyntaxNotes::R
Instance Attribute Summary collapse
- #indexes ⇒ Array<Integer> readonly
Instance Method Summary collapse
-
#forbidden(zipper) ⇒ Array<Zipper::AbstractCursor<Values::AbstractElementVal>>
Returns the AbstractElementVals from the given segment or composite element that must not be present, given the presence of other elements.
-
#initialize(indexes) ⇒ SyntaxNote
constructor
A new instance of SyntaxNote.
- #reason(zipper) ⇒ String
-
#required(zipper) ⇒ Array<Zipper::AbstractCursor<Values::AbstractElementVal>>
Returns the AbstractElementVals from the given segment or composite element that must be present, given the presence of other elements.
- #satisfied?(zipper) ⇒ Boolean
Constructor Details
#initialize(indexes) ⇒ SyntaxNote
Returns a new instance of SyntaxNote.
21 22 23 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 21 def initialize(indexes) @indexes = indexes end |
Instance Attribute Details
#indexes ⇒ Array<Integer> (readonly)
19 20 21 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 19 def indexes @indexes end |
Instance Method Details
#forbidden(zipper) ⇒ Array<Zipper::AbstractCursor<Values::AbstractElementVal>>
Returns the AbstractElementVals from the given segment or composite element that must not be present, given the presence of other elements
35 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 35 abstract :forbidden, :args => %w(zipper) |
#reason(zipper) ⇒ String
38 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 38 abstract :reason, :args => %w(zipper) |
#required(zipper) ⇒ Array<Zipper::AbstractCursor<Values::AbstractElementVal>>
Returns the AbstractElementVals from the given segment or composite element that must be present, given the presence of other elements
29 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 29 abstract :required, :args => %w(zipper) |
#satisfied?(zipper) ⇒ Boolean
40 41 42 43 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 40 def satisfied?(zipper) forbidden(zipper).all?{|c| c.node.blank? } and required(zipper).all?{|c| c.node.present? } end |