Class: 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::FunctionalGroups::FiftyTen::SyntaxNotes::C, Versions::FunctionalGroups::FiftyTen::SyntaxNotes::E, Versions::FunctionalGroups::FiftyTen::SyntaxNotes::L, Versions::FunctionalGroups::FiftyTen::SyntaxNotes::P, Versions::FunctionalGroups::FiftyTen::SyntaxNotes::R, Versions::FunctionalGroups::FortyTen::SyntaxNotes::C, Versions::FunctionalGroups::FortyTen::SyntaxNotes::E, Versions::FunctionalGroups::FortyTen::SyntaxNotes::L, Versions::FunctionalGroups::FortyTen::SyntaxNotes::P, Versions::FunctionalGroups::FortyTen::SyntaxNotes::R, Versions::FunctionalGroups::ThirtyFifty::SyntaxNotes::C, Versions::FunctionalGroups::ThirtyFifty::SyntaxNotes::E, Versions::FunctionalGroups::ThirtyFifty::SyntaxNotes::L, Versions::FunctionalGroups::ThirtyFifty::SyntaxNotes::P, Versions::FunctionalGroups::ThirtyFifty::SyntaxNotes::R, Versions::FunctionalGroups::ThirtyForty::SyntaxNotes::C, Versions::FunctionalGroups::ThirtyForty::SyntaxNotes::E, Versions::FunctionalGroups::ThirtyForty::SyntaxNotes::L, Versions::FunctionalGroups::ThirtyForty::SyntaxNotes::P, Versions::FunctionalGroups::ThirtyForty::SyntaxNotes::R, Versions::FunctionalGroups::ThirtyTen::SyntaxNotes::C, Versions::FunctionalGroups::ThirtyTen::SyntaxNotes::E, Versions::FunctionalGroups::ThirtyTen::SyntaxNotes::L, Versions::FunctionalGroups::ThirtyTen::SyntaxNotes::P, Versions::FunctionalGroups::ThirtyTen::SyntaxNotes::R, Versions::FunctionalGroups::TwoThousandOne::SyntaxNotes::C, Versions::FunctionalGroups::TwoThousandOne::SyntaxNotes::E, Versions::FunctionalGroups::TwoThousandOne::SyntaxNotes::L, Versions::FunctionalGroups::TwoThousandOne::SyntaxNotes::P, Versions::FunctionalGroups::TwoThousandOne::SyntaxNotes::R
Instance Attribute Summary collapse
- #indexes ⇒ Array<Integer> readonly
Instance Method Summary collapse
- #errors(zipper) ⇒ Array<Zipper::AbstractCursor<Values::AbstractElementVal>>
-
#forbidden ⇒ 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 ⇒ String
-
#required ⇒ 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.
19 20 21 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 19 def initialize(indexes) @indexes = indexes end |
Instance Attribute Details
Instance Method Details
#errors(zipper) ⇒ Array<Zipper::AbstractCursor<Values::AbstractElementVal>>
44 45 46 47 48 49 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 44 def errors(zipper) f = forbidden(zipper).select{|c| c.node.present? } r = required(zipper).reject{|c| c.node.present? } f.concat(r) end |
#forbidden ⇒ 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
33 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 33 abstract :forbidden, :args => %w(zipper) |
#reason ⇒ String
36 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 36 abstract :reason, :args => %w(zipper) |
#required ⇒ 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
27 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 27 abstract :required, :args => %w(zipper) |
#satisfied?(zipper) ⇒ Boolean
38 39 40 41 |
# File 'lib/stupidedi/schema/syntax_note.rb', line 38 def satisfied?(zipper) forbidden(zipper).all?{|c| c.node.blank? } and required(zipper).all?{|c| c.node.present? } end |