Class: Judges::Judges

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

Overview

Collection of all judges to run.

Author

Yegor Bugayenko (yegor256@gmail.com)

Copyright

Copyright © 2024 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(dir, lib, loog) ⇒ Judges

Returns a new instance of Judges.



31
32
33
34
35
# File 'lib/judges/judges.rb', line 31

def initialize(dir, lib, loog)
  @dir = dir
  @lib = lib
  @loog = loog
end

Instance Method Details

#each {|Pack| ... } ⇒ Object

Iterate over them all.

Yields:

  • (Pack)


39
40
41
42
43
44
# File 'lib/judges/judges.rb', line 39

def each
  Dir.glob(File.join(@dir, '**/*.rb')).each do |f|
    d = File.dirname(File.absolute_path(f))
    yield Judges::Judge.new(d, @lib, @loog)
  end
end

#each_with_index {|(Pack, Integer)| ... } ⇒ Object

Iterate over them all.

Yields:

  • ((Pack, Integer))


48
49
50
51
52
53
54
55
# File 'lib/judges/judges.rb', line 48

def each_with_index
  idx = 0
  each do |p|
    yield [p, idx]
    idx += 1
  end
  idx
end