Class: Relaton::Plateau::BibItem
- Inherits:
-
RelatonBib::BibliographicItem
- Object
- RelatonBib::BibliographicItem
- Relaton::Plateau::BibItem
- Defined in:
- lib/relaton/plateau/bibitem.rb
Instance Attribute Summary collapse
- #cover ⇒ Relaton::Plateau::Cover readonly
- #filesize ⇒ Integer readonly
- #stagename ⇒ Relaton::Plateau::Stagename readonly
Instance Method Summary collapse
-
#ext_schema ⇒ String
Fetch flavor schema version.
-
#initialize(**args) ⇒ BibItem
constructor
A new instance of BibItem.
- #to_asciibib(prefix = "") ⇒ Object
- #to_hash ⇒ Object
- #to_xml(**opts) ⇒ Object
Constructor Details
#initialize(**args) ⇒ BibItem
Returns a new instance of BibItem.
16 17 18 19 20 21 |
# File 'lib/relaton/plateau/bibitem.rb', line 16 def initialize(**args) @cover = args.delete(:cover) @filesize = args.delete(:filesize) @stagename = args.delete(:stagename) super(**args) end |
Instance Attribute Details
#cover ⇒ Relaton::Plateau::Cover (readonly)
8 9 10 |
# File 'lib/relaton/plateau/bibitem.rb', line 8 def cover @cover end |
#filesize ⇒ Integer (readonly)
14 15 16 |
# File 'lib/relaton/plateau/bibitem.rb', line 14 def filesize @filesize end |
#stagename ⇒ Relaton::Plateau::Stagename (readonly)
11 12 13 |
# File 'lib/relaton/plateau/bibitem.rb', line 11 def stagename @stagename end |
Instance Method Details
#ext_schema ⇒ String
Fetch flavor schema version
28 29 30 |
# File 'lib/relaton/plateau/bibitem.rb', line 28 def ext_schema @ext_schema ||= schema_versions["relaton-model-plateau"] end |
#to_asciibib(prefix = "") ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/relaton/plateau/bibitem.rb', line 66 def to_asciibib(prefix = "") pref = prefix.empty? ? "" : "#{prefix}." output = super output += stagename.to_asciibib prefix if stagename output += cover.to_asciibib prefix if cover output += "#{pref}filesize:: #{filesize}\n" if filesize output end |
#to_hash ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/relaton/plateau/bibitem.rb', line 55 def to_hash hash = super return hash unless has_ext_data? hash["ext"] ||= {} hash["ext"]["stagename"] = stagename.to_hash if stagename hash["ext"]["cover"] = cover.to_hash if cover hash["ext"]["filesize"] = filesize if filesize hash end |
#to_xml(**opts) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/relaton/plateau/bibitem.rb', line 37 def to_xml(**opts) super do |builder| if opts[:bibdata] && has_ext_data? ext = builder.ext do |b| doctype&.to_xml b b.subdoctype subdoctype if subdoctype editorialgroup&.to_xml b ics.each { |i| b.ics i } structuredidentifier&.to_xml b stagename&.to_xml b cover.to_xml b b.filesize filesize end ext["schema-version"] = ext_schema if !opts[:embedded] && respond_to?(:ext_schema) && ext_schema end end end |