Module: Rwc::Core::Concerns::Validation

Included in:
BaseInput
Defined in:
lib/rwc/core/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.



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

def valid?
  validate!
  errors.empty?
end

#validate! ⇒ Object

Validates the input. Must be implemented by including class.

Raises:

  • (NotImplementedError) —

    If not implemented.



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

def validate!
  raise NotImplementedError
end