Class: RelatonCalconnect::HitCollection

Inherits:
RelatonBib::HitCollection
  • Object
show all
Defined in:
lib/relaton_calconnect/hit_collection.rb

Constant Summary collapse

ENDPOINT =
"https://standards.calconnect.org/relaton/index.yaml".freeze
DATADIR =

ENDPOINT = “127.0.0.1:4000/relaton/index.yaml”.freeze

File.expand_path ".relaton/calconnect", Dir.home
DATAFILE =
File.expand_path "bibliography.yml", DATADIR
ETAGFILE =
File.expand_path "etag.txt", DATADIR

Instance Method Summary collapse

Constructor Details

#initialize(ref, year = nil, _opts = {}) ⇒ HitCollection

Returns a new instance of HitCollection.

Parameters:

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


16
17
18
19
20
21
22
23
24
# File 'lib/relaton_calconnect/hit_collection.rb', line 16

def initialize(ref, year = nil, _opts = {})
  @text = ref
  @year = year
  @fetched = false
  hits = from_yaml(ref).sort_by do |hit|
    hit.hit["revdate"] ? Date.parse(hit.hit["revdate"]) : Date.new
  end
  concat hits.reverse
end