Sha256: f961a6ca7bb22276de25065f276c7c5e9cc759409d57b4d8b30a192c2d96e75a

Contents?: true

Size: 507 Bytes

Versions: 146

Compression:

Stored size: 507 Bytes

Contents

# frozen_string_literal: true

module ActiveModel
  module Type
    module Helpers # :nodoc: all
      module Mutable
        def cast(value)
          deserialize(serialize(value))
        end

        # +raw_old_value+ will be the `_before_type_cast` version of the
        # value (likely a string). +new_value+ will be the current, type
        # cast value.
        def changed_in_place?(raw_old_value, new_value)
          raw_old_value != serialize(new_value)
        end
      end
    end
  end
end

Version data entries

146 entries across 142 versions & 14 rubygems

Version Path
activemodel-6.1.7.10 lib/active_model/type/helpers/mutable.rb
activemodel-6.1.7.9 lib/active_model/type/helpers/mutable.rb
activemodel-6.1.7.8 lib/active_model/type/helpers/mutable.rb
activemodel-6.1.7.7 lib/active_model/type/helpers/mutable.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activemodel-7.0.3.1/lib/active_model/type/helpers/mutable.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activemodel-7.0.2.3/lib/active_model/type/helpers/mutable.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activemodel-6.1.6.1/lib/active_model/type/helpers/mutable.rb
activemodel-6.1.7.6 lib/active_model/type/helpers/mutable.rb
activemodel-6.1.7.5 lib/active_model/type/helpers/mutable.rb
activemodel-6.1.7.4 lib/active_model/type/helpers/mutable.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activemodel-7.0.3.1/lib/active_model/type/helpers/mutable.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activemodel-6.1.6.1/lib/active_model/type/helpers/mutable.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activemodel-7.0.2.3/lib/active_model/type/helpers/mutable.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/helpers/mutable.rb
activemodel-7.0.4.3 lib/active_model/type/helpers/mutable.rb
activemodel-6.1.7.3 lib/active_model/type/helpers/mutable.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/helpers/mutable.rb
activemodel-6.1.7.2 lib/active_model/type/helpers/mutable.rb
activemodel-7.0.4.2 lib/active_model/type/helpers/mutable.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/helpers/mutable.rb