Sha256: 3942efcc74854ba3240142ed7b6c063ebde657adf20af08ae0eca6497893fceb

Contents?: true

Size: 358 Bytes

Versions: 22

Compression:

Stored size: 358 Bytes

Contents

module ApiResource

  module Typecast

    TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set
    FALSE_VALUES = [false, 0, '0', 'f', 'F', 'false', 'FALSE'].to_set

    module BooleanTypecaster

      def self.from_api(value)
        TRUE_VALUES.include?(value)
      end

      def self.to_api(value)
        value
      end

    end

  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
api_resource-0.6.21 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.20 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.19 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.18 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.17 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.16 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.15 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.14 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.13 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.12 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.11 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.9 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.10 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.8 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.7 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.6 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.5 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.4 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.3 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.2 lib/api_resource/typecasters/boolean_typecaster.rb