class Gbbib::GbBibliographicItem
GB bibliographic item class.
Attributes
ccs[R]
@return [Array<Cnccs::Ccs>]
committee[R]
@return [Gbbib::GbTechnicalCommittee]
gbtype[R]
@return [Gbbib::GbStandardType]
plan_number[R]
@return [String]
topic[R]
@return [String]
type[R]
@return [String]
Public Class Methods
new(**args)
click to toggle source
Calls superclass method
# File lib/gbbib/gb_bibliographic_item.rb, line 30 def initialize(**args) super args[:committee] and @committee = GbTechnicalCommittee.new(args[:committee]) @ccs = args[:ccs].map { |c| Cnccs.fetch c } @gbtype = GbStandardType.new args[:gbtype] @type = args[:type] end
Public Instance Methods
inspect()
click to toggle source
@return [String]
# File lib/gbbib/gb_bibliographic_item.rb, line 51 def inspect "<#{self.class}:#{format('%#.14x', object_id << 1)}>" # "@fullIdentifier=\"#{@fetch&.shortref}\" "\ # "@title=\"#{title}\">" end
makeid(id, attribute, delim = '')
click to toggle source
# File lib/gbbib/gb_bibliographic_item.rb, line 62 def makeid(id, attribute, delim = '') return nil if attribute && !@id_attribute id = @docidentifier.reject { |i| i.type == "DOI" }[0] unless id idstr = id.project_number.to_s if id.part_number&.size&.positive? idstr = idstr + "-#{id.part_number}" end idstr.strip end
to_s()
click to toggle source
@return [String]
# File lib/gbbib/gb_bibliographic_item.rb, line 58 def to_s inspect end
to_xml(builder = nil, **opts)
click to toggle source
@param builder [Nokogiri::XML::Builder] @return [String]
Calls superclass method
# File lib/gbbib/gb_bibliographic_item.rb, line 40 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
Private Instance Methods
render_gbxml(builder)
click to toggle source
@param builder [Nokogiri::XML::Builder]
# File lib/gbbib/gb_bibliographic_item.rb, line 75 def render_gbxml(builder) committee.to_xml builder if committee gbtype.to_xml builder return unless ccs.any? ccs.each do |c| builder.ccs do builder.code c.code builder.text_ c.description end end end