Skip to content
  • Jonathan Hefner's avatar
    43b98036
    Factor out deep_merge into AS::DeepMergeable · 43b98036
    Jonathan Hefner authored
    The `ActiveSupport::DeepMergeable` module allows a class to provide
    `deep_merge` and `deep_merge!` methods simply by implementing a
    `merge!(other, &block)` method.  Values will be deep merged only when
    they are compatible, according to `deep_merge?`.  By default, that only
    includes instances of the same class or its subclasses.  A class may
    override `deep_merge?` to further restrict or expand the domain of deep
    mergeable values.
    
    This does introduce a small change in behavior.  Previously,
    `Hash#deep_merge` would only deep merge `Hash` instances.  Now,
    `deep_merge` will deep merge any `DeepMergeable` instances that are
    compatible with each other.
    43b98036
    Factor out deep_merge into AS::DeepMergeable
    Jonathan Hefner authored
    The `ActiveSupport::DeepMergeable` module allows a class to provide
    `deep_merge` and `deep_merge!` methods simply by implementing a
    `merge!(other, &block)` method.  Values will be deep merged only when
    they are compatible, according to `deep_merge?`.  By default, that only
    includes instances of the same class or its subclasses.  A class may
    override `deep_merge?` to further restrict or expand the domain of deep
    mergeable values.
    
    This does introduce a small change in behavior.  Previously,
    `Hash#deep_merge` would only deep merge `Hash` instances.  Now,
    `deep_merge` will deep merge any `DeepMergeable` instances that are
    compatible with each other.
Loading