Total Complexity | 3 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | require_relative 'element' |
||
4 | class Collection |
||
5 | include Native |
||
6 | include Enumerable |
||
7 | |||
8 | def each(&block) |
||
9 | `self.native.length`.times do |i| |
||
10 | block.call Element.new(`self.native.item(i)`) |
||
11 | end |
||
12 | |||
13 | nil |
||
14 | end |
||
15 | |||
16 | def [](index) |
||
17 | Element.new(`self.native.item(index)`) |
||
18 | end |
||
19 | |||
20 | def length |
||
21 | `self.native.length` |
||
22 | end |
||
23 | end |
||
24 | end |
||
25 |