Sha256: 8d1e40e005c9dcec50cb2c701dce938f0dceab5ac2b6110f778a141eebb3e449

Contents?: true

Size: 550 Bytes

Versions: 17

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

require "active_model/type/immutable_string"

module ActiveModel
  module Type
    class String < ImmutableString # :nodoc:
      def changed_in_place?(raw_old_value, new_value)
        if new_value.is_a?(::String)
          raw_old_value != new_value
        end
      end

      private

        def cast_value(value)
          case value
          when ::String then ::String.new(value)
          when true then "t"
          when false then "f"
          else value.to_s
          end
        end
    end
  end
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
activemodel-6.0.2.2 lib/active_model/type/string.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/string.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/string.rb
activemodel-6.0.2.1 lib/active_model/type/string.rb
activemodel-6.0.2 lib/active_model/type/string.rb
activemodel-6.0.2.rc2 lib/active_model/type/string.rb
activemodel-6.0.2.rc1 lib/active_model/type/string.rb
activemodel-6.0.1 lib/active_model/type/string.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activemodel-6.0.0/lib/active_model/type/string.rb
activemodel-6.0.1.rc1 lib/active_model/type/string.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activemodel-6.0.0/lib/active_model/type/string.rb
activemodel-6.0.0 lib/active_model/type/string.rb
activemodel-6.0.0.rc2 lib/active_model/type/string.rb
activemodel-6.0.0.rc1 lib/active_model/type/string.rb
activemodel-6.0.0.beta3 lib/active_model/type/string.rb
activemodel-6.0.0.beta2 lib/active_model/type/string.rb
activemodel-6.0.0.beta1 lib/active_model/type/string.rb