Sha256: 606fb600d55c4d7c4d395f28915725910a1928c628064ea16ec2c20783527813

Contents?: true

Size: 443 Bytes

Versions: 1

Compression:

Stored size: 443 Bytes

Contents

require "mountapi/schema/base"

module Mountapi
  module Schema
    # Schema implementation for Boolean type
    class Boolean
      include Base

      # @param [Object] value
      #
      # cast value to boolean
      # it must be either true or false (string or boolean)
      def cast(value)
        word = value.to_s
        raise_cast_error(value) unless %w(true false).include?(word)
        word == "true"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mountapi-0.11.1 lib/mountapi/schema/boolean.rb