Module: Dry::Types::ReferenceHookToMatchSum Private
- Included in:
- Dry::Types
- Defined in:
- lib/dry/types/tuple.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Patch for [] inferrer, that adds support for ‘type|type|…` syntax to compose Sum types.
Instance Method Summary collapse
-
#[](name) ⇒ Dry::Types::Type
private
Wraps over the previously hooked method.
Instance Method Details
#[](name) ⇒ Dry::Types::Type
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Wraps over the previously hooked method.
264 265 266 267 268 269 270 271 272 273 |
# File 'lib/dry/types/tuple.rb', line 264 def [](name) type_map.fetch_or_store(name) do if sum_match = name.match(SUM_MATCH_REGEX) left, right = sum_match.captures self[left] | self[right] else super end end end |