Ruby / Nested leaf merge

Ruby Class Hash Leaf Merge

This page has a stable URL for review, documentation, and implementation comparison. The fixture tabs show merge inputs and output; the contract tabs show JSON and compact ruleset renderings with stable IDs and deterministic ownership.

Advanced .rb advanced leaf mergenested leavesdestination leaf winsrubyclass_hash_literal_leavesstructural_signaturenative_read_portable_writenormalize_tracked_layout_merge

Fixture sources

JSON fixture: structuredmerge-fixtures/ruby/slice-720-advanced-leaf-merge/class-hash-leaf-merge.json

Compact ruleset: structuredmerge-fixtures/rulesets/ruby/slice-720-advanced-leaf-merge/class-hash-leaf-merge.smrules

Fixture view
class PatientSummary
  PROFILE = {
    demographics: {
      name: {given: "Pat", family: "Template"},
      contact: {email: "[email protected]", phone: "555-0100"}
    },
    care_plan: {
      status: "draft",
      goals: {mobility: "walk daily", nutrition: "low sodium"}
    }
  }
end
Contract view
{
  "contract_id": "ruby-class-hash-leaf-merge",
  "format": "ruby",
  "owners": "class_hash_literal_leaves",
  "match": "structural_signature",
  "read": "native_read_portable_write",
  "attach": "normalize_tracked_layout_merge",
  "comment_style": "hash_comment",
  "render": "ruby_declarations",
  "surfaces": [
    {
      "name": "hash_pair",
      "selector": "stable_path"
    }
  ],
  "capabilities": {
    "nested_leaf_merge": true,
    "destination_leaf_wins": true,
    "template_missing_leaf_adds": true
  }
}