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-2025 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(loog) ⇒ Join

Initialize.

Parameters:

  • loog (Loog)

    Logging facility



21
22
23
# File 'lib/judges/commands/join.rb', line 21

def initialize(loog)
  @loog = loog
end

Instance Method Details

#run(_opts, args) ⇒ Object

Run the join command (called by the bin/judges script).

Parameters:

  • _opts (Hash)

    Command line options (not used)

  • args (Array)

    List of command line arguments

Raises:

  • (RuntimeError)

    If not exactly two arguments provided



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/judges/commands/join.rb', line 29

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 successfully'
  end
end