Class: ActiveModel::Type::String

Inherits:
ImmutableString show all
Defined in:
lib/active_model/type/string.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Value

#limit, #precision, #scale

Instance Method Summary collapse

Methods inherited from ImmutableString

#initialize, #serialize, #type

Methods inherited from Value

#==, #assert_valid_value, #binary?, #cast, #changed?, #deserialize, #force_equality?, #hash, #immutable_value, #initialize, #map, #serializable?, #serialize, #type, #type_cast_for_schema, #value_constructed_by_mass_assignment?

Constructor Details

This class inherits a constructor from ActiveModel::Type::ImmutableString

Instance Method Details

#changed_in_place?(raw_old_value, new_value) ⇒ Boolean

Returns:



8
9
10
11
12
# File 'lib/active_model/type/string.rb', line 8

def changed_in_place?(raw_old_value, new_value)
  if new_value.is_a?(::String)
    raw_old_value != new_value
  end
end

#to_immutable_stringObject



14
15
16
17
18
19
20
21
22
# File 'lib/active_model/type/string.rb', line 14

def to_immutable_string
  ImmutableString.new(
    true: @true,
    false: @false,
    limit: limit,
    precision: precision,
    scale: scale,
  )
end