Method: Doing::WWID#import

Defined in:
lib/doing/wwid/wwidutil.rb

#import(paths, opt) ⇒ Object

Imports external entries

Parameters:

  • paths (String)

    Path to JSON report file

  • opt (Hash)

    Additional Options



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/doing/wwid/wwidutil.rb', line 33

def import(paths, opt)
  opt ||= {}
  Plugins.plugins[:import].each do |_, options|
    next unless opt[:type] =~ /^(#{options[:trigger].normalize_trigger})$/i

    if paths.count.positive?
      paths.each do |path|
        options[:class].import(self, path, options: opt)
      end
    else
      options[:class].import(self, nil, options: opt)
    end
    break
  end
end