diff options
author | Elvin Efendi <elvin.efendiyev@gmail.com> | 2015-11-13 11:19:20 -0500 |
---|---|---|
committer | Elvin Efendi <elvin.efendiyev@gmail.com> | 2015-11-13 11:19:20 -0500 |
commit | 5a2364e50620b825d5325bfbbc5d0f3d8578e25f (patch) | |
tree | 0e985374cc7b4bd8111c012072c39218335881ef /lib/oxidized/source/csv.rb | |
parent | 1400b842f6dc61e662ce15f72f578a55126ffc06 (diff) | |
parent | f2da63369fcb754e3715091cc4fd2f93db42106e (diff) |
Merge pull request #2 from Shopify/testing-refactoring
Testing refactoring
Diffstat (limited to 'lib/oxidized/source/csv.rb')
-rw-r--r-- | lib/oxidized/source/csv.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/oxidized/source/csv.rb b/lib/oxidized/source/csv.rb index 5064e5e..a0ce848 100644 --- a/lib/oxidized/source/csv.rb +++ b/lib/oxidized/source/csv.rb @@ -1,17 +1,17 @@ module Oxidized class CSV < Source def initialize - @cfg = CFG.source.csv + @cfg = Oxidized.config.source.csv super end def setup if @cfg.empty? - CFGS.user.source.csv.file = File.join(Config::Root, 'router.db') - CFGS.user.source.csv.delimiter = /:/ - CFGS.user.source.csv.map.name = 0 - CFGS.user.source.csv.map.model = 1 - CFGS.save :user + Oxidized.asetus.user.source.csv.file = File.join(Config::Root, 'router.db') + Oxidized.asetus.user.source.csv.delimiter = /:/ + Oxidized.asetus.user.source.csv.map.name = 0 + Oxidized.asetus.user.source.csv.map.model = 1 + Oxidized.asetus.save :user raise NoConfig, 'no source csv config, edit ~/.config/oxidized/config' end end @@ -19,7 +19,7 @@ class CSV < Source def load nodes = [] open(File.expand_path @cfg.file).each_line do |line| - next if line.match /^\s*#/ + next if line.match(/^\s*#/) data = line.chomp.split @cfg.delimiter next if data.empty? # map node parameters |