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
-
#fetch(lang = nil) ⇒ RelatonIso::IsoBibliographicItem
Parse page.
- #sort_weight ⇒ Object
- #to_xml(builder = nil, **opts) ⇒ Object
Instance Attribute Details
#hit_collection ⇒ RelatonIso::HitCollection (readonly)
7 8 9 |
# File 'lib/relaton_iso/hit.rb', line 7 def hit_collection @hit_collection end |
Instance Method Details
#fetch(lang = nil) ⇒ RelatonIso::IsoBibliographicItem
Parse page.
12 13 14 |
# File 'lib/relaton_iso/hit.rb', line 12 def fetch(lang = nil) @fetch ||= Scrapper.parse_page @hit, lang end |
#sort_weight ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/relaton_iso/hit.rb', line 28 def sort_weight case hit["publicationStatus"] when "Published" then 0 when "Under development" then 1 when "Withdrawn" then 2 else 3 end end |
#to_xml(builder = nil, **opts) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/relaton_iso/hit.rb', line 17 def to_xml(builder = nil, **opts) if builder fetch.to_xml builder, **opts else builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml| fetch.to_xml xml, **opts end builder.doc.root.to_xml end end |