module Validate::AST::DefinitionContext::Builder

Public Instance Methods

all_constraints(*constraints) click to toggle source
# File lib/validate/ast.rb, line 16
def all_constraints(*constraints)
  Rules::Unanimous.new(constraints.map { |node| send(*node) })
end
at_least_one_constraint(*constraints) click to toggle source
# File lib/validate/ast.rb, line 20
def at_least_one_constraint(*constraints)
  Rules::Affirmative.new(constraints.map { |node| send(*node) })
end
constraint(name, args, block, trace) click to toggle source
# File lib/validate/ast.rb, line 28
def constraint(name, args, block, trace)
  if defined?(Constraints) && Constraints.respond_to?(name)
    begin
      return Constraints.send(name, *(args.map { |node| send(*node) }), &block)
    rescue => e
      ::Kernel.raise Error::ValidationRuleError, e.message, trace
    end
  end

  Rules::Pending.new(name, args.map { |node| send(*node) }, block, trace)
end
no_constraints(*constraints) click to toggle source
# File lib/validate/ast.rb, line 24
def no_constraints(*constraints)
  Rules::Negative.new(constraints.map { |node| send(*node) })
end
value(value) click to toggle source
# File lib/validate/ast.rb, line 40
def value(value)
  value
end