Class: Jsus::Util::Validator::Base

Inherits:
Object
  • Object
show all
Includes:
Mixins::OperatesOnSources
Defined in:
lib/jsus/util/validator/base.rb

Direct Known Subclasses

Mooforge

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::OperatesOnSources

#source_files, #source_files=

Constructor Details

#initialize(pool_or_array_or_container = []) ⇒ Base

Constructor accepts pool or array or container and adds every file to its source files set.

Parameters:



12
13
14
# File 'lib/jsus/util/validator/base.rb', line 12

def initialize(pool_or_array_or_container = [])
  self.source_files = pool_or_array_or_container
end

Class Method Details

.validate(*args) ⇒ Object

Shortcut for creating and validating a list of items

Parameters:

  • args (*Array)

    passed to #new



31
32
33
# File 'lib/jsus/util/validator/base.rb', line 31

def self.validate(*args)
  new(*args).validate
end

Instance Method Details

#validateBoolean

Returns whether or not given sources conform to given set of rules.

Returns:

  • (Boolean)

    whether or not given sources conform to given set of rules



18
19
20
# File 'lib/jsus/util/validator/base.rb', line 18

def validate
  validation_errors.empty?
end

#validation_errorsArray

Returns list of validation errors.

Returns:

  • (Array)

    list of validation errors



24
25
26
# File 'lib/jsus/util/validator/base.rb', line 24

def validation_errors
  []
end