Class: RelatonNist::Hit
- Inherits:
-
RelatonBib::Hit
- Object
- RelatonBib::Hit
- RelatonNist::Hit
- Defined in:
- lib/relaton_nist/hit.rb
Overview
Hit.
Instance Method Summary collapse
Instance Method Details
#fetch ⇒ RelatonNist::NistBliographicItem
Parse page.
8 9 10 |
# File 'lib/relaton_nist/hit.rb', line 8 def fetch @fetch ||= Scrapper.parse_page @hit end |
#sort_value ⇒ Iteger
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/relaton_nist/hit.rb', line 13 def sort_value @sort_value ||= begin sort_phrase = [hit[:serie], hit[:code], hit[:title]].join " " corr = hit_collection&.text&.split&.map do |w| if w =~ /\w+/ && sort_phrase =~ Regexp.new(Regexp.escape(w), Regexp::IGNORECASE) 1 else 0 end end&.sum.to_i corr + case hit[:status] when "final" then 4 when "withdrawn" then 3 when "draft" then 2 when "draft (obsolete)" then 1 else 0 end end end |