Class: Stupidedi::Versions::Common::SyntaxNotes::C

Inherits:
Schema::SyntaxNote show all
Defined in:
lib/stupidedi/versions/common/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

#initialize, #satisfied?

Constructor Details

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

Class Method Details

.build(*args)



159
160
161
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 159

def build(*args)
  new(args)
end

Instance Method Details

#forbidden(zipper)



104
105
106
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 104

def forbidden(zipper)
  []
end

#reason(zipper)



108
109
110
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 108

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

#required(zipper)



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/stupidedi/versions/common/syntax_notes.rb', line 92

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