Sha256: 9a141ee605f89036f6c14e7b77f75a60ff26a26eb8e81ab5f042da73d6516ee9

Contents?: true

Size: 606 Bytes

Versions: 13

Compression:

Stored size: 606 Bytes

Contents

require 'active_model'

module ActiveModel
  module Type
    module Salesforce
      class Multipicklist < ActiveModel::Type::Value
        include ActiveModel::Type::Helpers::Mutable

        def type
          :multipicklist
        end

        def deserialize(value)
          value.to_s.split(';')
        end

        def serialize(value)
          return if value.blank?

          return value if value.is_a?(::String)

          value.to_a.reject(&:empty?).join(';')
        end
      end
    end
  end
end

ActiveModel::Type.register(:multipicklist, ActiveModel::Type::Salesforce::Multipicklist)

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
active_force-0.24.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.23.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.22.1 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.22.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.21.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.20.1 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.20.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.19.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.18.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.17.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.16.0 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.15.1 lib/active_model/type/salesforce/multipicklist.rb
active_force-0.15.0 lib/active_model/type/salesforce/multipicklist.rb