34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/tanemaki.rb', line 34
def ready(path)
, *lines = CSV.read(path)
nameless = []
readiness = .map.with_index do |name, index|
if name
name.to_sym
else
nameless.push(index)
nil
end
end
lines.map do |line|
nameless_parameter = []
line.each_with_index.each_with_object({}) do |(col, index), result|
if nameless.include?(index)
nameless_parameter.push(col) if col
else
result[readiness[index]] = col if col
end
end.merge(namelass_parameter_array: nameless_parameter)
end
end
|