Class: Relaton::Calconnect::HitCollection

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

Constant Summary collapse

GHURL =

ENDPOINT = “standards.calconnect.org/relaton/index.yaml”.freeze ENDPOINT = “127.0.0.1:4000/relaton/index.yaml”.freeze DATADIR = File.expand_path “.relaton/calconnect”, Dir.home DATAFILE = File.expand_path “bibliography.yml”, DATADIR ETAGFILE = File.expand_path “etag.txt”, DATADIR

"https://raw.githubusercontent.com/relaton/relaton-data-calconnect/refs/heads/v2/".freeze

Instance Method Summary collapse

Constructor Details

#initialize(ref, year = nil) ⇒ HitCollection

Returns a new instance of HitCollection.

Parameters:

  • ref (Strig)
  • year (String) (defaults to: nil)
  • opts (Hash)


17
18
19
20
21
22
23
24
25
26
# File 'lib/relaton/calconnect/hit_collection.rb', line 17

def initialize(ref, year = nil)
  super
  # @array = from_yaml(ref).sort_by do |hit|
  #   hit.hit["revdate"] ? Date.parse(hit.hit["revdate"]) : Date.new
  # end.reverse
  index = Relaton::Index.find_or_create :CC, url: "#{GHURL}#{INDEXFILE}.zip", file: "#{INDEXFILE}.yaml"
  @array = index.search(ref).map do |row|
    Hit.new(row, self)
  end
end