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 ⇒ 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 ⇒ RelatonIso::IsoBibliographicItem
Parse page.
11 12 13 |
# File 'lib/relaton_iso/hit.rb', line 11 def fetch @fetch ||= Scrapper.parse_page @hit end |
#sort_weight ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/relaton_iso/hit.rb', line 27 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
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/relaton_iso/hit.rb', line 16 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 |