Class: DrySchemaRails::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dry_schema_rails/base.rb

Class Method Summary collapse

Class Method Details

.call(*args) ⇒ Object



9
10
11
# File 'lib/dry_schema_rails/base.rb', line 9

def call(*args)
  params.call(*args)
end

.paramsObject Also known as: contract



13
14
15
# File 'lib/dry_schema_rails/base.rb', line 13

def params
  Dry::Schema.Params(&_schema_proc)
end

.schema(&block) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/dry_schema_rails/base.rb', line 19

def schema(&block)
  if block_given?
    self._schema_proc = block
  else
    _schema_proc
  end
end