Class: RelatonNist::Hit
- Inherits:
-
RelatonBib::Hit
- Object
- RelatonBib::Hit
- RelatonNist::Hit
- Defined in:
- lib/relaton_nist/hit.rb
Overview
Hit.
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#hit_collection ⇒ RelatonNist::HitCollection (readonly)
7 8 9 |
# File 'lib/relaton_nist/hit.rb', line 7 def hit_collection @hit_collection end |
Instance Method Details
#fetch ⇒ RelatonNist::NistBliographicItem
Parse page.
11 12 13 |
# File 'lib/relaton_nist/hit.rb', line 11 def fetch @fetch ||= Scrapper.parse_page @hit end |
#sort_value ⇒ Iteger
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/relaton_nist/hit.rb', line 16 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 corr + case hit[:status] when "final" then 3 when "withdrawn" then 2 when "draft (withdrawn)" then 1 else 0 end end end |