Class: Judges::Packs

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

Overview

Collection of all packs to run.

Author

Yegor Bugayenko (yegor256@gmail.com)

Copyright

Copyright © 2024 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(dir, loog) ⇒ Packs

Returns a new instance of Packs.



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

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

Instance Method Details

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

Iterate over them all.

Yields:



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

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

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

Iterate over them all.

Yields:



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

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