Sha256: 8c58cfb324a72356a63a8abbf1fea77d412bd076fac5d3ae90b32507e6548fcc

Contents?: true

Size: 344 Bytes

Versions: 11

Compression:

Stored size: 344 Bytes

Contents

# frozen_string_literal: true

module Codebreaker
  module Validator
    def check_type(data, check_type)
      raise TypeError, 'unexpected_type' unless data.instance_of? check_type
    end

    def check_length(data, check)
      raise ArgumentError, 'unexpected_length' unless (check[:min]..check[:max]).cover? data.length
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
codebreaker_marian-0.3.6 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.3.5 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.3.4 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.3.3 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.3.2 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.3.1 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.3.0 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.2.9 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.2.8 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.2.7 lib/codebreaker_marian/modules/validator.rb
codebreaker_marian-0.2.6 lib/codebreaker_marian/modules/validator.rb