Sha256: cbcaf52e1378ce0719aaa555b978f59c80247592af8f5ef64bfe6188ff813d00

Contents?: true

Size: 285 Bytes

Versions: 1

Compression:

Stored size: 285 Bytes

Contents

module Compel
  module Coercion

    class Boolean < Type

      def coerce!
        if /(false|f|no|n|0)$/i === "#{value}"
          return false
        end

        if /(true|t|yes|y|1)$/i === "#{value}"
          return true
        end

        fail
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
compel-0.2.0 lib/compel/coercion/boolean.rb