Sha256: a200fbdd93465ef012155b3c3921a683b2ead049c1ff84fae161ae13d3341235
Contents?: true
Size: 478 Bytes
Versions: 9
Compression:
Stored size: 478 Bytes
Contents
module Goliath module Rack module Types class Boolean < Base TRUE_STRINGS = ['true', 't', '1'] FALSE_STRINGS = ['false', 'f', '0'] ERROR_MESSAGE = "%s is not a boolean value" def _coerce(val) downcased_val = val.downcase return true if TRUE_STRINGS.include?(downcased_val) return false if FALSE_STRINGS.include?(downcased_val) raise ERROR_MESSAGE % val end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems