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 ([email protected])
- Copyright
-
Copyright © 2024-2025 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
-
#initialize(loog) ⇒ Trim
constructor
A new instance of Trim.
-
#run(opts, args) ⇒ Object
Run it (it is supposed to be called by the
bin/judgesscript..
Constructor Details
#initialize(loog) ⇒ Trim
Returns a new instance of Trim.
20 21 22 |
# File 'lib/judges/commands/trim.rb', line 20 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.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/judges/commands/trim.rb', line 27 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 |