Class: Result

Inherits:
Object
  • Object
show all
Defined in:
lib/teuton-get/searcher/result.rb

Constant Summary collapse

@@repoindex =
Set.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Result

Returns a new instance of Result.



10
11
12
13
14
15
# File 'lib/teuton-get/searcher/result.rb', line 10

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

Instance Attribute Details

#reponameObject (readonly)

Returns the value of attribute reponame.



7
8
9
# File 'lib/teuton-get/searcher/result.rb', line 7

def reponame
  @reponame
end

#scoreObject

Returns the value of attribute score.



6
7
8
# File 'lib/teuton-get/searcher/result.rb', line 6

def score
  @score
end

#testnameObject (readonly)

Returns the value of attribute testname.



8
9
10
# File 'lib/teuton-get/searcher/result.rb', line 8

def testname
  @testname
end

Instance Method Details

#idObject



17
18
19
# File 'lib/teuton-get/searcher/result.rb', line 17

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

#repoindexObject



31
32
33
# File 'lib/teuton-get/searcher/result.rb', line 31

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

#to_hObject



21
22
23
24
25
26
27
28
29
# File 'lib/teuton-get/searcher/result.rb', line 21

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