---
title: "إنشاء جداول التجزئة الوسيطة تلقائيًا في Ruby"
description: "ستُنشأ جميع جداول التجزئة في المستويات الوسيطة تلقائيًا وكأنها بالسحر"
canonical: https://oozou.com/til/automagical-intermediate-level-hashtables-in-ruby-62
locale: ar
date: 2020-10-13
topic: ruby
---

# إنشاء جداول التجزئة الوسيطة تلقائيًا في Ruby

> ستُنشأ جميع جداول التجزئة في المستويات الوسيطة تلقائيًا وكأنها بالسحر

Published: 2020-10-13 · Topic: [ruby](https://oozou.com/ar/til-topics/ruby) ([markdown](https://oozou.com/ar/til-topics/ruby.md))

ستُنشأ جميع جداول التجزئة في المستويات الوسيطة تلقائيًا وكأنها بالسحر

```ruby
def autovivifying_hash
   Hash.new {|ht,k| ht[k] = autovivifying_hash}
end
```

### طريقة الاستخدام

```ruby
response_builder = autovivifying_hash
response_builder['payment']['status'] = 'OK'
response_builder # => {"payment"=>{"status"=>"OK"}
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/ar/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
