Class: RelatonIso::Hit
- Inherits:
-
RelatonBib::Hit
- Object
- RelatonBib::Hit
- RelatonIso::Hit
- Defined in:
- lib/relaton_iso/hit.rb
Overview
Hit.
Instance Attribute Summary collapse
Instance Method Summary collapse
- #sort_weight ⇒ Integer
-
#update_edition(bibliographic_item) ⇒ Object
Update edition for pubid when provided in Bibliographic Item.
Instance Attribute Details
#fetch(lang = nil) ⇒ RelatonIso::IsoBibliographicItem
Parse page.
24 25 26 27 28 29 |
# File 'lib/relaton_iso/hit.rb', line 24 def fetch(lang = nil) @fetch ||= Scrapper.parse_page self, lang # update edition for pubid using fetched data update_edition(@fetch) @fetch end |
#pubid ⇒ Pubid::Iso::Identifier
43 44 45 46 47 48 49 |
# File 'lib/relaton_iso/hit.rb', line 43 def pubid @pubid ||= Pubid::Iso::Identifier.parse_from_title(hit[:title]) rescue Pubid::Iso::Errors::WrongTypeError, Pubid::Iso::Errors::ParseError => e Util.warn "Unable to find an identifier in: `#{hit[:title]}`." Util.warn e. end |
Instance Method Details
#sort_weight ⇒ Integer
32 33 34 35 36 37 38 39 40 |
# File 'lib/relaton_iso/hit.rb', line 32 def sort_weight case hit[:status] # && hit["publicationStatus"]["key"] when "Published" then 0 when "Under development" then 1 when "Withdrawn" then 2 when "Deleted" then 3 else 4 end end |
#update_edition(bibliographic_item) ⇒ Object
Update edition for pubid when provided in Bibliographic Item
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/relaton_iso/hit.rb', line 10 def update_edition(bibliographic_item) if bibliographic_item.edition # add edition to base document if available if pubid.base pubid.base.edition = bibliographic_item.edition.content else pubid.edition = bibliographic_item.edition.content end end end |