Module: DependencyManager::ConfigSchemaMacros::ClassMethods

Defined in:
lib/dependency_manager/config_schema_macros.rb

Instance Method Summary collapse

Instance Method Details

#validate(**configuration) ⇒ Dry::Validation::Result

Runs validator

Parameters:

  • **configuration (Hash[Symbol, Any])

    Hash to validate with schema

Returns:

  • (Dry::Validation::Result)


69
70
71
# File 'lib/dependency_manager/config_schema_macros.rb', line 69

def validate(**configuration)
  @dry_schema.call(configuration)
end

#validate_with(&dry_schema) ⇒ Dry::Schema

Class-level macro for validations

Parameters:

  • &dry_schema (Proc)

    Dry Schema to validate with

Returns:

  • (Dry::Schema)

See Also:



59
60
61
# File 'lib/dependency_manager/config_schema_macros.rb', line 59

def validate_with(&dry_schema)
  @dry_schema = Dry::Schema.Params(&dry_schema)
end