Module: Performify::Validation::ClassMethods

Defined in:
lib/performify/validation.rb

Instance Method Summary collapse

Instance Method Details

#schema(outer_schema = nil, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/performify/validation.rb', line 9

def schema(outer_schema = nil, &block)
  if block_given?
    @schema = Dry::Schema.Params(**{}, &block)
  elsif outer_schema.present? && outer_schema.is_a?(Dry::Schema::Params)
    @schema = outer_schema
  else
    @schema
  end
end