Sha256: 0ab8611b41f0657b35480fa74f8a15e6b8db28f55f15cc8712991b17e48b7007

Contents?: true

Size: 298 Bytes

Versions: 1

Compression:

Stored size: 298 Bytes

Contents

module WeakParameters
  class BooleanValidator < WeakParameters::BaseValidator
    def type
      :boolean
    end

    private

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
weak_parameters-0.0.2 lib/weak_parameters/boolean_validator.rb