class Tanemaki::Parser
Public Class Methods
call(*args)
click to toggle source
# File lib/tanemaki.rb, line 29 def call(*args) ready(*args) end
ready(path)
click to toggle source
# File lib/tanemaki.rb, line 34 def ready(path) header, *lines = CSV.read(path) nameless = [] readiness = header.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