Class: Judges::Join

Inherits:
Object show all
Defined in:
lib/judges/commands/join.rb

Overview

The join command.

This class is instantiated by the bin/judge command line interface. You are not supposed to instantiate it yourself.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2024 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(loog) ⇒ Join

Returns a new instance of Join.



36
37
38
# File 'lib/judges/commands/join.rb', line 36

def initialize(loog)
  @loog = loog
end

Instance Method Details

#run(_opts, args) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/judges/commands/join.rb', line 40

def run(_opts, args)
  raise 'Exactly two arguments required' unless args.size == 2
  master = Judges::Impex.new(@loog, args[0])
  slave = Judges::Impex.new(@loog, args[1])
  elapsed(@loog, level: Logger::INFO) do
    fb = master.import
    slave.import_to(fb)
    master.export(fb)
    throw :'Two factbases joined'
  end
end