Sha256: 21767bdc071df3102c2a78c0cd1541fdc1afa0c83aa215c43189419e44e8a13d

Contents?: true

Size: 276 Bytes

Versions: 10

Compression:

Stored size: 276 Bytes

Contents

module Compel
  module Coercion

    class Boolean < Type

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

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

    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
compel-0.5.1 lib/compel/coercion/types/boolean.rb
compel-0.5.0 lib/compel/coercion/types/boolean.rb
compel-0.4.3 lib/compel/coercion/types/boolean.rb
compel-0.4.2 lib/compel/coercion/types/boolean.rb
compel-0.4.0 lib/compel/coercion/types/boolean.rb
compel-0.3.7 lib/compel/coercion/types/boolean.rb
compel-0.3.6 lib/compel/coercion/types/boolean.rb
compel-0.3.4 lib/compel/coercion/types/boolean.rb
compel-0.3.2 lib/compel/coercion/types/boolean.rb
compel-0.3.1 lib/compel/coercion/types/boolean.rb