Class: Relaton::Plateau::HitCollection

Inherits:
Core::HitCollection
  • Object
show all
Defined in:
lib/relaton/plateau/hit_collection.rb

Constant Summary collapse

ENDPOINT =
"https://raw.githubusercontent.com/relaton/relaton-data-plateau/data-v2/"

Instance Method Summary collapse

Instance Method Details

#fetch_docObject



19
20
21
22
23
# File 'lib/relaton/plateau/hit_collection.rb', line 19

def fetch_doc
  return unless any?

  all_editions? ? to_all_editions : first.item
end

#findObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/relaton/plateau/hit_collection.rb', line 8

def find
  @array = index.search do |row|
    if all_editions?
      row[:id].sub(/ \d+\.\d+$/, "") == @ref
    else
      row[:id] == @ref
    end
  end.map { |row| Hit.new(row, self) }
  self
end

#indexObject



25
26
27
28
29
# File 'lib/relaton/plateau/hit_collection.rb', line 25

def index
  @index ||= Relaton::Index.find_or_create(
    :plateau, url: "#{ENDPOINT}#{INDEXFILE}.zip", file: "#{INDEXFILE}.yaml"
  )
end