Total Complexity | 0 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 83 | ||
Bugs | 0 | Features | 0 |
1 | # frozen_string_literal: true |
||
8 | class Mapper |
||
9 | class Type |
||
10 | module BuiltIn |
||
11 | # Pair class definition |
||
12 | class HashTupleType < Type |
||
13 | def initialize |
||
14 | super(Aux::HashTuple, virtual: true) |
||
15 | |||
16 | attribute!(:key, parameter!(:K)) |
||
17 | attribute!(:value, parameter!(:V)) |
||
18 | |||
19 | enumerator_block do |entity, type, *| |
||
20 | ::Enumerator.new do |yielder| |
||
21 | yielder << [type.attributes[:key], entity.key, nil] |
||
22 | yielder << [type.attributes[:value], entity.value, nil] |
||
23 | end |
||
24 | end |
||
25 | end |
||
26 | |||
27 | INSTANCE = new |
||
28 | end |
||
29 | end |
||
30 | end |
||
31 | end |
||
32 | end |
||
34 |