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

Inherits:
Schema::SyntaxNote
  • Object
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)


130
131
132
# File 'lib/stupidedi/versions/functional_groups/005010/syntax_notes.rb', line 130

def build(*args)
  new(args)
end

Instance Method Details

#forbidden(zipper)


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

def forbidden(zipper)
  []
end

#reason(zipper)


124
125
126
# File 'lib/stupidedi/versions/functional_groups/005010/syntax_notes.rb', line 124

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

#required(zipper)


112
113
114
115
116
117
118
# File 'lib/stupidedi/versions/functional_groups/005010/syntax_notes.rb', line 112

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