class DTOSchema::Checks::CheckBinder

It provides check-binding API:

check.length(min: 2, max: 3)

Public Class Methods

new(schema) click to toggle source
# File lib/dto_schema/checks.rb, line 66
def initialize (schema)
  @schema = schema
end

Public Instance Methods

method_missing(name, args = {}) click to toggle source

Bind a check by its name passed as dynamic method name. It is this method that implements check-binding API in schema definition.

# File lib/dto_schema/checks.rb, line 72
def method_missing (name, args = {})
  check = CheckReference.new @schema, name
  BoundCheck.new check, args
end