Module: IS::Deep::ArrayStrategies
- Defined in:
- lib/is-deep/strategies.rb
Overview
Namespace for array merge strategies.
Strategies are callable objects (lambdas or class instances with #call) that determine how two arrays should be merged.
Defined Under Namespace
Classes: KeyBased
Constant Summary collapse
- REPLACE =
Replace strategy: other array replaces base entirely.
lambda { |_, other| other }
- CONCAT =
Concat strategy: append other to base (default).
Preserves duplicates and order.
lambda { |base, other| base + other }
- UNION =
Union strategy: combine arrays removing duplicates.
Uses == for equality comparison. Order is preserved from base, then unique elements from other are appended.
lambda { |base, other| base | other }
- KEY_BASED =
Predefined KeyBased instances for common keys.
{ detect: KeyBased::new(nil), id: KeyBased::new(:id), name: KeyBased::new(:name), key: KeyBased::new(:key), host: KeyBased::new(:host), }