Sha256: 155cd7eb1a7cebf093ca9a52df34927189052f939a5632b1ba1f420f9be74ef2

Contents?: true

Size: 565 Bytes

Versions: 4

Compression:

Stored size: 565 Bytes

Contents

require 'active_model/type/string'

#TODO Need to consider namespace change since paremt class moved to ActiveModel
module ActiveRecord
  module OracleEnhanced
    module Type
      class Raw < ActiveModel::Type::String # :nodoc:
        def type
          :raw
        end

        def serialize(value)
          # Encode a string or byte array as string of hex codes
          if value.nil?
            super
          else
            value = value.unpack('C*')
            value.map { |x| "%02X" % x }.join
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-oracle_enhanced-adapter-1.7.11 lib/active_record/oracle_enhanced/type/raw.rb
activerecord-oracle_enhanced-adapter-1.7.10 lib/active_record/oracle_enhanced/type/raw.rb
activerecord-oracle_enhanced-adapter-1.7.9 lib/active_record/oracle_enhanced/type/raw.rb
activerecord-oracle_enhanced-adapter-1.7.8 lib/active_record/oracle_enhanced/type/raw.rb