Sha256: 49734e52db717b7623a1e0d42326a415ebaaadf3e187883575431ba3ffa897f3
Contents?: true
Size: 792 Bytes
Versions: 2
Compression:
Stored size: 792 Bytes
Contents
# frozen_string_literal: true module CodebrekerManfly module Validator def valid_class?(expected_class, instance) instance.is_a?(expected_class) end def valid_non_empty_string?(string) !string.empty? end def valid_positive_integer?(number) number.positive? end def valid_non_negative_integer?(number) !number.negative? end def valid_string_min_length?(string, min_length) string.length >= min_length end def valid_string_max_length?(string, max_length) string.length <= max_length end def valid_only_numeric_string?(string) /\A\d+\Z/.match?(string) end def valid_range?(range, code) code.each { |digit| return false unless range.cover?(digit) } true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
codebreker_manfly-0.1.2 | lib/codebreker_manfly/modules/validator.rb |
codebreker_manfly-0.1.1 | lib/codebreker_manfly/modules/validator.rb |