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.1 lib/api_resource/typecasters/boolean_typecaster.rb
api_resource-0.6.0 lib/api_resource/typecasters/boolean_typecaster.rb