Sha256: 80a622dfee0b946e92e2c1d0ef388a099c5069ac06a736bc3aa85ed94221180a

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

require_relative "../settings"

class Result
  @@repoindex = Set.new

  attr_accessor :score
  attr_reader :reponame
  attr_reader :testname

  def initialize(args)
    @score = args[:score] || 0
    @reponame = args[:reponame] || "???"
    @testname = args[:testname] || "???"
    @@repoindex << @reponame
  end

  def id
    "#{reponame}#{Settings::SEPARATOR}#{testname}"
  end

  def to_h
    {
      score: @score,
      id: id,
      reponame: @reponame,
      testname: @testname,
      repoindex: repoindex
    }
  end

  def repoindex
    @@repoindex.to_a.index(@reponame)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
teuton-get-0.3.1 lib/teuton-get/searcher/result.rb
teuton-get-0.3.0 lib/teuton-get/searcher/result.rb