Class: Judges::Trim
Overview
The trim command.
This class is instantiated by the bin/judge command line interface. You are not supposed to instantiate it yourself.
- Author
-
Yegor Bugayenko (yegor256@gmail.com)
- Copyright
-
Copyright © 2024-2025 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
-
#initialize(loog) ⇒ Trim
constructor
Initialize.
-
#run(opts, args) ⇒ Object
Run it (it is supposed to be called by the
bin/judgesscript..
Constructor Details
#initialize(loog) ⇒ Trim
Initialize.
22 23 24 |
# File 'lib/judges/commands/trim.rb', line 22 def initialize(loog) @loog = loog end |
Instance Method Details
#run(opts, args) ⇒ Object
Run it (it is supposed to be called by the bin/judges script.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/judges/commands/trim.rb', line 29 def run(opts, args) raise 'Exactly one argument required' unless args.size == 1 impex = Judges::Impex.new(@loog, args[0]) fb = impex.import elapsed(@loog, level: Logger::INFO) do deleted = fb.query(opts['query']).delete! throw :'No facts deleted' if deleted.zero? impex.export(fb) throw :"🗑 #{deleted} fact(s) deleted" end end |