travis-ci
5 of 5 new or added lines in 2 files covered. (100.0%)
457 of 460 relevant lines covered (99.35%)
12.38 hits per line
1 |
module Riif::DSL |
4✔ |
2 |
class Base |
4✔ |
3 |
|
|
4 |
def initialize |
4✔ |
5 |
@rows = []
|
124✔ |
6 |
@current_row = []
|
124✔ |
7 |
end
|
|
8 |
|
|
9 |
def build(&block) |
4✔ |
10 |
|
|
11 |
instance_eval(&block) |
124✔ |
12 |
|
|
13 |
output |
124✔ |
14 |
end
|
|
15 |
|
|
16 |
def row(&block) |
4✔ |
17 |
@current_row = [self.class::START_COLUMN] |
128✔ |
18 |
|
|
19 |
instance_eval(&block) |
128✔ |
20 |
|
|
21 |
@rows << @current_row |
128✔ |
22 |
end
|
|
23 |
|
|
24 |
def output |
4✔ |
25 |
{ |
|
26 |
headers: headers,
|
|
27 |
rows: rows
|
|
28 |
} |
124✔ |
29 |
end
|
|
30 |
|
|
31 |
def headers |
4✔ |
32 |
[ |
|
33 |
["!#{self.class::START_COLUMN}"].concat(
|
|
34 |
self.class::HEADER_COLUMNS.map(&:upcase) |
|
35 |
) |
76✔ |
36 |
] |
|
37 |
end
|
|
38 |
|
|
39 |
def rows |
4✔ |
40 |
@rows
|
104✔ |
41 |
end
|
|
42 |
|
|
43 |
def method_missing(method_name, *args, &block) |
4✔ |
|
if self.class::HEADER_COLUMNS.include?(method_name) |
568✔ |
|
@current_row[self.class::HEADER_COLUMNS.index(method_name) + 1] = args[0] |
568✔ |
46 |
else
|
|
47 |
super
|
× |
48 |
end
|
|
49 |
end
|
|
50 |
end
|
|
51 |
end
|