Module: Rwc::Concerns::Validation

Defined in:
lib/rwc/concerns/validation.rb

Overview

Provides validation methods for input classes.

Instance Method Summary collapse

Instance Method Details

#valid?Boolean

Checks if the input is valid by running validations.

Returns:

  • (Boolean)

    True if valid; otherwise, false.



10
11
12
13
# File 'lib/rwc/concerns/validation.rb', line 10

def valid?
  validate!
  errors.empty?
end

#validate!Object

Validates the input. Must be implemented by including class.

Raises:

  • (NotImplementedError)

    If not implemented.



18
19
20
# File 'lib/rwc/concerns/validation.rb', line 18

def validate!
  raise NotImplementedError
end