Class: Stupidedi::Schema::SyntaxNote

Inherits:
Object
  • Object
show all
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)

See Also:

  • B.1.1.3.5 Syntax Notes
  • B.1.1.3.9 Condition Designator

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

Instance Method Summary collapse

Constructor Details

#initialize(indexes) ⇒ SyntaxNote


23
24
25
# File 'lib/stupidedi/schema/syntax_note.rb', line 23

def initialize(indexes)
  @indexes = indexes
end

Instance Attribute Details

#indexesArray<Integer> (readonly)


21
22
23
# File 'lib/stupidedi/schema/syntax_note.rb', line 21

def indexes
  @indexes
end

Instance Method Details

#errors(zipper) ⇒ Array<Zipper::AbstractCursor<Values::AbstractElementVal>>


48
49
50
51
52
53
# File 'lib/stupidedi/schema/syntax_note.rb', line 48

def errors(zipper)
  f = forbidden(zipper).select{|c| c.node.present? }
  r = required(zipper).reject{|c| c.node.present? }

  f.concat(r)
end

#forbiddenArray<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


37
# File 'lib/stupidedi/schema/syntax_note.rb', line 37

abstract :forbidden, :args => %w(zipper)

#reasonString


40
# File 'lib/stupidedi/schema/syntax_note.rb', line 40

abstract :reason, :args => %w(zipper)

#requiredArray<Zipper::AbstractCursor<Values::AbstractElementVal>>

Returns the AbstractElementVals from the given segment or composite element that must be present, given the presence of other elements


31
# File 'lib/stupidedi/schema/syntax_note.rb', line 31

abstract :required, :args => %w(zipper)

#satisfied?(zipper) ⇒ Boolean


42
43
44
45
# File 'lib/stupidedi/schema/syntax_note.rb', line 42

def satisfied?(zipper)
  forbidden(zipper).all?{|c| c.node.blank? } and
    required(zipper).all?{|c| c.node.present? }
end