class ActiveModel::ForcedMutationTracker
:nodoc:
def attr_names
def attr_names forced_changes.keys end
def attribute_changed?(attr_name)
def attribute_changed?(attr_name) forced_changes.include?(attr_name) end
def change_to_attribute(attr_name)
def change_to_attribute(attr_name) if finalized_changes&.include?(attr_name) finalized_changes[attr_name].dup else super end end
def changed_in_place?(attr_name)
def changed_in_place?(attr_name) false end
def clone_value(attr_name)
def clone_value(attr_name) value = fetch_value(attr_name) value.duplicable? ? value.clone : value rescue TypeError, NoMethodError value end
def fetch_value(attr_name)
def fetch_value(attr_name) attributes.send(:_read_attribute, attr_name) end
def finalize_changes
def finalize_changes @finalized_changes = changes end
def force_change(attr_name)
def force_change(attr_name) forced_changes[attr_name] = clone_value(attr_name) unless attribute_changed?(attr_name) end
def forget_change(attr_name)
def forget_change(attr_name) forced_changes.delete(attr_name) end
def initialize(attributes)
def initialize(attributes) super @finalized_changes = nil end
def original_value(attr_name)
def original_value(attr_name) if changed?(attr_name) forced_changes[attr_name] else fetch_value(attr_name) end end
def type_cast(attr_name, value)
def type_cast(attr_name, value) value end