Sha256: 0cf2e262bcaf011b5eb0b3739928f7b41140931d960855ab68148a57bcfa1d97

Contents?: true

Size: 339 Bytes

Versions: 1

Compression:

Stored size: 339 Bytes

Contents

module Superstore
  module Types
    class BooleanType < ActiveModel::Type::Value
      TRUE_VALS = [true, 'true', '1']
      FALSE_VALS = [false, 'false', '0']

      def cast_value(value)
        if TRUE_VALS.include?(value)
          true
        elsif FALSE_VALS.include?(value)
          false
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
superstore-2.5.0 lib/superstore/types/boolean_type.rb