Module: Pathway::Plugins::DryValidation

Defined in:
lib/pathway/plugins/dry_validation.rb,
lib/pathway/plugins/dry_validation/v1_0.rb,
lib/pathway/plugins/dry_validation/v0_11.rb,
lib/pathway/plugins/dry_validation/v0_12.rb

Defined Under Namespace

Modules: V0_11, V0_12, V1_0

Class Method Summary collapse

Class Method Details

.apply(operation, **kwargs) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pathway/plugins/dry_validation.rb', line 8

def self.apply(operation, **kwargs)
  #:nocov:
  if Gem.loaded_specs['dry-validation'].version < Gem::Version.new('0.11')
    fail 'unsupported dry-validation gem version'
  elsif Gem.loaded_specs['dry-validation'].version < Gem::Version.new('0.12')
    require 'pathway/plugins/dry_validation/v0_11'
    operation.plugin(Plugins::DryValidation::V0_11, **kwargs)
  elsif Gem.loaded_specs['dry-validation'].version < Gem::Version.new('1.0')
    require 'pathway/plugins/dry_validation/v0_12'
    operation.plugin(Plugins::DryValidation::V0_12, **kwargs)
  else
    require 'pathway/plugins/dry_validation/v1_0'
    operation.plugin(Plugins::DryValidation::V1_0, **kwargs)
  end
  #:nocov:
end