class ActiveModel::Type::Value

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/active_model/type/value.rbs

class ActiveModel::Type::Value
  def binary?: () -> untyped
  def cast: (Integer value) -> Integer
end

def ==(other)

def ==(other)
  self.class == other.class &&
    precision == other.precision &&
    scale == other.scale &&
    limit == other.limit
end

def assert_valid_value(_)

def assert_valid_value(_)
end

def binary? # :nodoc:

Experimental RBS support (using type sampling data from the type_fusion project).

def binary?: () -> untyped

This signature was generated using 1 sample from 1 application.

:nodoc:
their use, and see if they can be removed entirely.
These predicates are not documented, as I need to look further into
def binary? # :nodoc:
  false
end

def cast(value)

Experimental RBS support (using type sampling data from the type_fusion project).

def cast: (Integer value) -> Integer

This signature was generated using 1 sample from 1 application.

+value+ The raw input, as provided to the attribute setter.

Value#cast_value.
ActiveRecord::AttributeMethods::Read#read_attribute. See also:
The return value of this method will be returned from

from.
There is currently no way to differentiate between which source it came
be a string from the form builder, or a ruby object passed to a setter.
Type casts a value from user input (e.g. from a setter). This value may
def cast(value)
  cast_value(value) unless value.nil?
end

def cast_value(value) # :doc:

:doc:
values except +nil+.
behavior for user and database inputs. Called by Value#cast for
Convenience method for types which do not need separate type casting
def cast_value(value) # :doc:
  value
end

def changed?(old_value, new_value, _new_value_before_type_cast)

override this method.
and +new_value+ will always be type-cast. Types should not need to
Determines whether a value has changed for dirty checking. +old_value+
def changed?(old_value, new_value, _new_value_before_type_cast)
  old_value != new_value
end

def changed_in_place?(raw_old_value, new_value)

+new_value+ The current value, after type casting.

+deserialize+.
+raw_old_value+ The original value, before being passed to

+new_value+
- pass +raw_old_value+ to Value#deserialize and compare it to

or

+raw_old_value+
- pass +new_value+ to Value#serialize and compare it to

to either:
which could be mutated, you should override this method. You will need
read. Returns +false+ by default. If your type returns an object
Determines whether the mutable value has been modified since it was
def changed_in_place?(raw_old_value, new_value)
  false
end

def deserialize(value)

+value+ The raw input, as provided from the database.

implementation just calls Value#cast.
ActiveRecord::AttributeMethods::Read#read_attribute. The default
return value of this method will be returned from
Converts a value from database input to the appropriate ruby type. The
def deserialize(value)
  cast(value)
end

def force_equality?(_value) # :nodoc:

:nodoc:
def force_equality?(_value) # :nodoc:
  false
end

def hash

def hash
  [self.class, precision, scale, limit].hash
end

def initialize(precision: nil, limit: nil, scale: nil)

def initialize(precision: nil, limit: nil, scale: nil)
  @precision = precision
  @scale = scale
  @limit = limit
end

def map(value) # :nodoc:

:nodoc:
def map(value) # :nodoc:
  yield value
end

def serializable?(value)

parameter is some other object.
value parameter is a Ruby boolean, but may return +false+ if the value
by the database. For example a boolean type can return +true+ if the
Returns true if this type can convert +value+ to a type that is usable
def serializable?(value)
  true
end

def serialize(value)

+nil+.
+String+, +Numeric+, +Date+, +Time+, +Symbol+, +true+, +false+, or
to understand. The returned value from this method should be a
Casts a value from the ruby type to a type that the database knows how
def serialize(value)
  value
end

def type # :nodoc:

:nodoc:
def type # :nodoc:
end

def type_cast_for_schema(value) # :nodoc:

:nodoc:
hoping to remove it entirely.
Type casts a value for schema dumping. This method is private, as we are
def type_cast_for_schema(value) # :nodoc:
  value.inspect
end

def value_constructed_by_mass_assignment?(_value) # :nodoc:

:nodoc:
def value_constructed_by_mass_assignment?(_value) # :nodoc:
  false
end