Class: Stupidedi::Versions::FunctionalGroups::FiftyTen::SyntaxNotes::C

Inherits:
Schema::SyntaxNote show all
Defined in:
lib/stupidedi/versions/functional_groups/005010/syntax_notes.rb

Overview

Conditional: if the first element specified in the condition is present, then all other elements must be specified.

Instance Attribute Summary

Attributes inherited from Schema::SyntaxNote

#indexes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Schema::SyntaxNote

#errors, #initialize, #satisfied?

Constructor Details

This class inherits a constructor from Stupidedi::Schema::SyntaxNote

Class Method Details

.build(*args) ⇒ Object



127
128
129
# File 'lib/stupidedi/versions/functional_groups/005010/syntax_notes.rb', line 127

def build(*args)
  new(args)
end

Instance Method Details

#forbidden(zipper) ⇒ Object



117
118
119
# File 'lib/stupidedi/versions/functional_groups/005010/syntax_notes.rb', line 117

def forbidden(zipper)
  []
end

#reason(zipper) ⇒ Object



121
122
123
# File 'lib/stupidedi/versions/functional_groups/005010/syntax_notes.rb', line 121

def reason(zipper)
  "elements #{indexes.tail.join(", ")} must be present when element #{indexes.head} is present"
end

#required(zipper) ⇒ Object



109
110
111
112
113
114
115
# File 'lib/stupidedi/versions/functional_groups/005010/syntax_notes.rb', line 109

def required(zipper)
  if zipper.child(indexes.head - 1).node.present?
    children(zipper).tail
  else
    []
  end
end