Sha256: 29d3e8e631a98e43275bd56d52c5b7dc8602789497be2a3c1c379b52bd7760cd

Contents?: true

Size: 601 Bytes

Versions: 7

Compression:

Stored size: 601 Bytes

Contents

module Codebreaker
  module Validation
    def validate_in_range?(argument, range)
      range.include? argument
    end

    def valid_name?(name, range)
      validate_in_range?(name.length, range)
    end

    def valid_digits?(digits, range)
      digits.chars.map(&:to_i).each do |digit|
        return unless validate_in_range?(digit, range)
      end
    end

    def validate_presence?(entity)
      !entity.empty?
    end

    def validate_match(entity)
      entity.to_i.to_s == entity
    end

    def validate_length(entity, set_length)
      entity.length == set_length
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
codebreaker_PI-6.6.7 lib/modules/validation.rb
codebreaker_PI-6.6.6 lib/modules/validation.rb
codebreaker_PI-0.6.5 lib/modules/validation.rb
codebreaker_PI-0.6.4 lib/modules/validation.rb
codebreaker_PI-0.6.1 lib/modules/validation.rb
codebreaker_PI-0.6.0 lib/modules/validation.rb
codebreaker_PI-0.0.1 lib/modules/validation.rb