From efa7ee3789ace917a66904252090986af0400c25 Mon Sep 17 00:00:00 2001 From: Anton Aksola Date: Mon, 5 May 2014 15:48:12 +0300 Subject: missing edits --- lib/oxidized/source/csv.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/oxidized/source') diff --git a/lib/oxidized/source/csv.rb b/lib/oxidized/source/csv.rb index 9d291c7..113c272 100644 --- a/lib/oxidized/source/csv.rb +++ b/lib/oxidized/source/csv.rb @@ -20,11 +20,18 @@ class CSV < Source nodes = [] open(@cfg.file).each_line do |line| data = line.chomp.split @cfg.delimiter + # map node parameters keys = {} @cfg.map.each do |key, position| keys[key.to_sym] = data[position] end keys[:model] = map_model keys[:model] if keys.key? :model + + # map node specific vars, empty value is considered as nil + vars = {} + @cfg.vars_map.each { |key, position| vars[key.to_sym] = data[position].to_s.empty? ? nil : data[position] } + keys[:vars] = vars unless vars.empty? + nodes << keys end nodes -- cgit v1.2.3