Class: RelatonUn::EditorialGroup

Inherits:
Object
  • Object
show all
Includes:
RelatonBib
Defined in:
lib/relaton_un/editorialgroup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(committee) ⇒ EditorialGroup

Returns a new instance of EditorialGroup.

Parameters:

  • committee (Array<String>)


9
10
11
# File 'lib/relaton_un/editorialgroup.rb', line 9

def initialize(committee)
  @committee = committee
end

Instance Attribute Details

#committeeArray<String> (readonly)

Returns:

  • (Array<String>)


6
7
8
# File 'lib/relaton_un/editorialgroup.rb', line 6

def committee
  @committee
end

Instance Method Details

#presence?true

Returns:

  • (true)


14
15
16
# File 'lib/relaton_un/editorialgroup.rb', line 14

def presence?
  true
end

#to_asciibib(prefix) ⇒ String

Parameters:

  • prefix (String)

Returns:

  • (String)


32
33
34
35
36
# File 'lib/relaton_un/editorialgroup.rb', line 32

def to_asciibib(prefix)
  pref = prefix.empty? ? prefix : prefix + "."
  pref += "editorialgroup"
  committee.map { |c| "#{pref}.committee:: #{c}\n" }.join
end

#to_hashArray<Hash>, Hash

Returns:

  • (Array<Hash>, Hash)


26
27
28
# File 'lib/relaton_un/editorialgroup.rb', line 26

def to_hash
  single_element_array(committee.map { |c| { "committee" => c } })
end

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


19
20
21
22
23
# File 'lib/relaton_un/editorialgroup.rb', line 19

def to_xml(builder)
  builder.editorialgroup do |b|
    committee.each { |c| b.committee c }
  end
end