---
title: "إنشاء Hash من Enumerable (Rails 6.0)"
description: "دالة جديدة تتيح لكم إنشاء Hash من Enumerable:"
canonical: https://oozou.com/til/create-a-hash-from-an-enumerable-rails-6-0-6
locale: ar
date: 2020-10-13
topic: ruby-on-rails
---

# إنشاء Hash من Enumerable (Rails 6.0)

> دالة جديدة تتيح لكم إنشاء Hash من Enumerable:

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

دالة جديدة تتيح لكم إنشاء Hash من Enumerable:

```ruby
%w(driver owner drivy).index_with(nil)
# => { 'driver' => nil, 'owner' => nil, 'drivy' => nil }

%w(driver owner drivy).index_with { |role| delta_amount_for(role) }
# => { 'driver' => '...', 'owner' => '...', 'drivy' => '...' }
```

---

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"
