Class: RelatonGb::GbBibliographicItem
- Inherits:
-
RelatonIsoBib::IsoBibliographicItem
- Object
- RelatonIsoBib::IsoBibliographicItem
- RelatonGb::GbBibliographicItem
- Defined in:
- lib/relaton_gb/gb_bibliographic_item.rb
Overview
GB bibliographic item class.
Instance Attribute Summary collapse
- #ccs ⇒ Array<Cnccs::Ccs> readonly
- #committee ⇒ RelatonGb::GbTechnicalCommittee readonly
- #gbplannumber ⇒ String readonly
- #gbtype ⇒ RelatonGb::GbStandardType readonly
- #plan_number ⇒ String readonly
- #topic ⇒ String readonly
- #type ⇒ String readonly
Instance Method Summary collapse
-
#initialize(**args) ⇒ GbBibliographicItem
constructor
A new instance of GbBibliographicItem.
- #inspect ⇒ String
- #makeid(id, attribute, _delim = "") ⇒ Object
- #to_s ⇒ String
- #to_xml(builder = nil, **opts) ⇒ String
Constructor Details
#initialize(**args) ⇒ GbBibliographicItem
Returns a new instance of GbBibliographicItem.
30 31 32 33 34 35 36 37 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 30 def initialize(**args) super args[:committee] && @committee = GbTechnicalCommittee.new(args[:committee]) @ccs = args[:ccs].map { |c| Cnccs.fetch c } @gbtype = GbStandardType.new args[:gbtype] @type = args[:type] @gbplannumber = args[:gbplannumber] || structuredidentifier&.project_number end |
Instance Attribute Details
#ccs ⇒ Array<Cnccs::Ccs> (readonly)
22 23 24 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 22 def ccs @ccs end |
#committee ⇒ RelatonGb::GbTechnicalCommittee (readonly)
13 14 15 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 13 def committee @committee end |
#gbplannumber ⇒ String (readonly)
28 29 30 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 28 def gbplannumber @gbplannumber end |
#gbtype ⇒ RelatonGb::GbStandardType (readonly)
16 17 18 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 16 def gbtype @gbtype end |
#plan_number ⇒ String (readonly)
25 26 27 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 25 def plan_number @plan_number end |
#topic ⇒ String (readonly)
19 20 21 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 19 def topic @topic end |
#type ⇒ String (readonly)
28 29 30 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 28 def type @type end |
Instance Method Details
#inspect ⇒ String
52 53 54 55 56 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 52 def inspect "<#{self.class}:#{format('%#.14x', object_id << 1)}>" # "@fullIdentifier=\"#{@fetch&.shortref}\" "\ # "@title=\"#{title}\">" end |
#makeid(id, attribute, _delim = "") ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 63 def makeid(id, attribute, _delim = "") return nil if attribute && !@id_attribute id ||= @docidentifier.reject { |i| i.type == "DOI" }[0] idstr = id.id # if id.part_number&.size&.positive? # idstr = idstr + "-#{id.part_number}" # end idstr.gsub(/\s/, "").strip end |
#to_s ⇒ String
59 60 61 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 59 def to_s inspect end |
#to_xml(builder = nil, **opts) ⇒ String
41 42 43 44 45 46 47 48 49 |
# File 'lib/relaton_gb/gb_bibliographic_item.rb', line 41 def to_xml(builder = nil, **opts) if builder super(builder, **opts) { |xml| render_gbxml(xml) } else Nokogiri::XML::Builder.new(encoding: "UTF-8") do |bldr| super(bldr, **opts) { |xml| render_gbxml(xml) } end.doc.root.to_xml end end |