Class: RelatonBib::BiblioNoteCollection

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/relaton_bib/biblio_note.rb

Instance Method Summary collapse

Constructor Details

#initialize(notes) ⇒ BiblioNoteCollection

Returns a new instance of BiblioNoteCollection.



8
9
10
# File 'lib/relaton_bib/biblio_note.rb', line 8

def initialize(notes)
  @array = notes
end

Instance Method Details

#<<(bibnote) ⇒ self

Parameters:

Returns:

  • (self)


14
15
16
17
# File 'lib/relaton_bib/biblio_note.rb', line 14

def <<(bibnote)
  @array << bibnote
  self
end

#to_xml(**opts) ⇒ Object

Parameters:

  • opts (Hash)

Options Hash (**opts):

  • XML (Nokogiri::XML::Builder)

    builder

  • :lang (String)

    language



22
23
24
25
26
# File 'lib/relaton_bib/biblio_note.rb', line 22

def to_xml(**opts)
  bnc = @array.select { |bn| bn.language&.include? opts[:lang] }
  bnc = @array unless bnc.any?
  bnc.each { |bn| bn.to_xml opts[:builder] }
end