Sha256: 30f69aab4878c3ebd6b493d106dec583a36ed8c3f69f5a1b272e398bab2c6a90

Contents?: true

Size: 564 Bytes

Versions: 35

Compression:

Stored size: 564 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".freeze
          when false then "f".freeze
          else value.to_s
          end
        end
    end
  end
end

Version data entries

35 entries across 35 versions & 4 rubygems

Version Path
activemodel-5.2.8.1 lib/active_model/type/string.rb
activemodel-5.2.8 lib/active_model/type/string.rb
activemodel-5.2.7.1 lib/active_model/type/string.rb
activemodel-5.2.7 lib/active_model/type/string.rb
activemodel-5.2.6.3 lib/active_model/type/string.rb
activemodel-5.2.6.2 lib/active_model/type/string.rb
activemodel-5.2.6.1 lib/active_model/type/string.rb
activemodel-5.2.6 lib/active_model/type/string.rb
activemodel-5.2.4.6 lib/active_model/type/string.rb
activemodel-5.2.5 lib/active_model/type/string.rb
activemodel-5.2.4.5 lib/active_model/type/string.rb
activemodel-5.2.4.4 lib/active_model/type/string.rb
activemodel-5.2.4.3 lib/active_model/type/string.rb
activemodel-5.2.4.2 lib/active_model/type/string.rb
activemodel-5.2.4.1 lib/active_model/type/string.rb
activemodel-5.2.4 lib/active_model/type/string.rb
activemodel-5.2.4.rc1 lib/active_model/type/string.rb
spiral_form-0.1.1 vendor/bundle/gems/activemodel-5.2.3/lib/active_model/type/string.rb
spiral_form-0.1.0 vendor/bundle/gems/activemodel-5.2.3/lib/active_model/type/string.rb
ric-0.13.0 vendor/bundle/ruby/2.5.0/gems/activemodel-5.2.3/lib/active_model/type/string.rb