Class: RelatonIsoBib::IsoSubgroup

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_iso_bib/editorial_group.rb

Overview

ISO subgroup.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type: nil, number: nil) ⇒ IsoSubgroup

Returns a new instance of IsoSubgroup.

Parameters:

  • name (String)
  • type (String, NilClass) (defaults to: nil)
  • number (Integer, NilClass) (defaults to: nil)


94
95
96
97
98
# File 'lib/relaton_iso_bib/editorial_group.rb', line 94

def initialize(name:, type: nil, number: nil)
  @name   = name
  @type   = type
  @number = number
end

Instance Attribute Details

#nameString (readonly)

Returns:

  • (String)


89
90
91
# File 'lib/relaton_iso_bib/editorial_group.rb', line 89

def name
  @name
end

#numberInteger, NilClass (readonly)

Returns:

  • (Integer, NilClass)


86
87
88
# File 'lib/relaton_iso_bib/editorial_group.rb', line 86

def number
  @number
end

#typeString, NilClass (readonly)

Returns:

  • (String, NilClass)


83
84
85
# File 'lib/relaton_iso_bib/editorial_group.rb', line 83

def type
  @type
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


108
109
110
111
112
113
# File 'lib/relaton_iso_bib/editorial_group.rb', line 108

def to_hash
  hash = { "name" => name }
  hash["type"] = type if type
  hash["number"] = number if number
  hash
end

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


101
102
103
104
105
# File 'lib/relaton_iso_bib/editorial_group.rb', line 101

def to_xml(builder)
  builder.parent[:number] = number if number
  builder.parent[:type] = type if type
  builder.text name
end