Sha256: fa4f3d9b9fa8212a177e3e61165d0c9db2a6c27e131bfbcf2c65003fbfc5ead1

Contents?: true

Size: 322 Bytes

Versions: 6

Compression:

Stored size: 322 Bytes

Contents

module NubeFact::Validator
  def validate!
    #ToDO change for a real validator like ActiveModel::Validations or Hanami::Validations
    self.class::REQUIRED_FIELDS.each do |field|
      if send(field).nil?
        raise NubeFact::ValidationError.new "#{field} it's a required field."
      end
    end
    true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nubefact-0.0.8 lib/util/validator.rb
nubefact-0.0.7 lib/util/validator.rb
nubefact-0.0.6 lib/util/validator.rb
nubefact-0.0.5 lib/util/validator.rb
nubefact-0.0.3 lib/util/validator.rb
nubefact-0.0.2 lib/util/validator.rb