Sha256: b4c33ebc9fb1ccd44d6c2f164baf3a150c66393ebc400705f690ceb86e1fb281

Contents?: true

Size: 509 Bytes

Versions: 3

Compression:

Stored size: 509 Bytes

Contents

---
title: Map
layout: gem-single
name: dry-types
---

`Map` describes a homogeneous hashmap. This means only types of keys and values are known. You can simply imagine a map input as a list of key-value pairs.

```ruby
int_float_hash = Types::Hash.map(Types::Integer, Types::Float)
int_float_hash[100 => 300.0, 42 => 70.0]
# => {100=>300.0, 42=>70.0}

# Only accepts mappings of integers to floats
int_float_hash[name: 'Jane']
# => Dry::Types::MapError: input key :name is invalid: type?(Integer, :name)
```

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-types-1.2.2 docsite/source/map.html.md
dry-types-1.2.1 docsite/source/map.html.md
dry-types-1.2.0 docsite/source/map.html.md