Class: Judges::Inspect
Overview
The inspect 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
-
#initialize(loog) ⇒ Inspect
constructor
Initialize.
-
#run(_opts, args) ⇒ Object
Run the inspect command (called by the
bin/judgesscript).
Constructor Details
#initialize(loog) ⇒ Inspect
Initialize.
21 22 23 |
# File 'lib/judges/commands/inspect.rb', line 21 def initialize(loog) @loog = loog end |
Instance Method Details
#run(_opts, args) ⇒ Object
Run the inspect command (called by the bin/judges script).
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/judges/commands/inspect.rb', line 29 def run(_opts, args) raise 'At least one argument required' if args.empty? fb = Judges::Impex.new(@loog, args[0]).import @loog.info("Facts: #{fb.size}") sum = fb.query('(eq what "judges-summary")').each.to_a if sum.empty? @loog.info('Summary fact not found') else @loog.info("Summary fact found:\n\t#{Factbase::FactAsYaml.new(sum.first).gsub("\n", "\n\t")}") end end |