Sha256: 7a7baa8cd69535069e40b39a2d79b738275808d53fea19f821873567f4cc1319

Contents?: true

Size: 350 Bytes

Versions: 1

Compression:

Stored size: 350 Bytes

Contents

module Superstore
  module Types
    class StringType < Base
      def serialize(str)
        return if str.nil?

        unless str.encoding == Encoding::UTF_8
          (str.frozen? ? str.dup : str).force_encoding('UTF-8')
        else
          str
        end
      end

      def cast_value(value)
        value.to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
superstore-3.0.0 lib/superstore/types/string_type.rb