Sha256: 2ed7da1d9f32a2baa8152bca0d38c0f172ddcc282554df5d6131b44a54160030

Contents?: true

Size: 266 Bytes

Versions: 5

Compression:

Stored size: 266 Bytes

Contents

module WeakParameters
  class BooleanValidator < WeakParameters::BaseValidator
    private

    def valid_type?
      %w[0 1 false true].include?(value.to_s)
    end

    def error_message
      "params[#{key.inspect}] must be 0, 1, false or true"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
weak_parameters-0.0.8 lib/weak_parameters/boolean_validator.rb
weak_parameters-0.0.7 lib/weak_parameters/boolean_validator.rb
weak_parameters-0.0.6 lib/weak_parameters/boolean_validator.rb
weak_parameters-0.0.5 lib/weak_parameters/boolean_validator.rb
weak_parameters-0.0.4 lib/weak_parameters/boolean_validator.rb