Class: PolishGeeks::DevTools::Validators::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/polish_geeks/dev_tools/validators/base.rb

Overview

This class is abstract.

Subclass and use

Base class for all the validators

Direct Known Subclasses

Rails, Rubocop, Simplecov

Instance Method Summary collapse

Constructor Details

#initialize(stored_output) ⇒ Base

Returns a new instance of Base.



8
9
10
# File 'lib/polish_geeks/dev_tools/validators/base.rb', line 8

def initialize(stored_output)
  @stored_output = stored_output
end

Instance Method Details

#valid?Boolean

This should be implemented in a subclass

Returns:

  • (Boolean)

    if validation check is valid or not

Raises:



14
15
16
# File 'lib/polish_geeks/dev_tools/validators/base.rb', line 14

def valid?
  raise Errors::NotImplementedError
end

#validate!Boolean

Returns if validation check is valid or not.

Returns:

  • (Boolean)

    if validation check is valid or not

Raises:

  • (PreCommandValidationError)

    when valid? return false



20
21
22
# File 'lib/polish_geeks/dev_tools/validators/base.rb', line 20

def validate!
  raise Errors::PreCommandValidationError unless valid?
end