module Kybus::Nanoservice::Validator

This module is a singleton that stores all the validator plugins A validator plugin is introduced into metatypes and used to validate that types are properly validated. See more on the validators documentations.

Public Class Methods

register_plugin(name) { |value, conf| ... } click to toggle source
# File lib/kybus/nanoservice/validator.rb, line 13
def self.register_plugin(name)
  block = lambda do |value, conf|
    yield(value, conf) ? nil : "#{name} failed!"
  end
  register(:validators, name, block)
end
register_type(type) { |value| ... } click to toggle source
# File lib/kybus/nanoservice/validator.rb, line 25
def self.register_type(type)
  block = proc { |value| yield(value) }
  register(:types, type, block)
end
type_alias(type, new_name) click to toggle source
# File lib/kybus/nanoservice/validator.rb, line 30
def self.type_alias(type, new_name)
  validator = resource(:types, type)
  register(:types, new_name, validator)
end
validator(name) click to toggle source
# File lib/kybus/nanoservice/validator.rb, line 35
def self.validator(name)
  resource(:validators, name)
end
validator_alias(name, new_name) click to toggle source
# File lib/kybus/nanoservice/validator.rb, line 20
def self.validator_alias(name, new_name)
  validator = resource(:validators, name)
  register(:validators, new_name, validator)
end