lib/csv2hash/yaml_loader.rb in csv2hash-0.6.5 vs lib/csv2hash/yaml_loader.rb in csv2hash-0.6.6
- old
+ new
@@ -10,10 +10,14 @@
def initialize file
@conf = load_config_file file
self.conf.deep_symbolize_keys!
end
+ def self.load! file
+ new(file).tap &:load!
+ end
+
def load!
mapping = self.conf.fetch(:mapping)
header_size = self.conf.fetch(:header_size).to_i
structure_rules = self.conf.fetch(:structure_rules)
@@ -26,9 +30,10 @@
self.conf.fetch(:rules).each do |rule|
definition.cells << Cell.new(rule)
end
Main[self.conf.fetch(:name)] = self.definition
+ nil
end
private
def load_config_file file