Class: IsoBibItem::Series

Inherits:
Object
  • Object
show all
Defined in:
lib/iso_bib_item/series.rb

Overview

Series class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Series

Returns a new instance of Series.

Parameters:

  • **args (Hash)

    <description>



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/iso_bib_item/series.rb', line 38

def initialize(**args)
  unless args[:title].is_a? IsoBibItem::FormattedString
    raise ArgumentError, 'Parametr `title` shoud present'
  end
  @type         = args[:type] if %w[main alt].include? args[:type]
  @title        = args[:title]
  @place        = args[:place]
  @organization = args[:organization]
  @abbreviation = args[:abbreviation]
  @from         = args[:from]
  @to           = args[:to]
  @number       = args[:number]
  @part_number  = args[:part_number]
end

Instance Attribute Details

#abbreviationIsoBibItem::LocalizedString (readonly)



21
22
23
# File 'lib/iso_bib_item/series.rb', line 21

def abbreviation
  @abbreviation
end

#fromString (readonly)

Returns date or year.

Returns:

  • (String)

    date or year



24
25
26
# File 'lib/iso_bib_item/series.rb', line 24

def from
  @from
end

#numberString (readonly)

Returns:

  • (String)


30
31
32
# File 'lib/iso_bib_item/series.rb', line 30

def number
  @number
end

#organizationString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/iso_bib_item/series.rb', line 18

def organization
  @organization
end

#part_numberString (readonly)

Returns:

  • (String)


33
34
35
# File 'lib/iso_bib_item/series.rb', line 33

def part_number
  @part_number
end

#placeString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/iso_bib_item/series.rb', line 15

def place
  @place
end

#titleIsoBibItem::FormattedString (readonly)

Returns title.

Returns:



12
13
14
# File 'lib/iso_bib_item/series.rb', line 12

def title
  @title
end

#toString (readonly)

Returns date or year.

Returns:

  • (String)

    date or year



27
28
29
# File 'lib/iso_bib_item/series.rb', line 27

def to
  @to
end

#typeString (readonly)

Returns allowed values: “main” or “alt”.

Returns:

  • (String)

    allowed values: “main” or “alt”



9
10
11
# File 'lib/iso_bib_item/series.rb', line 9

def type
  @type
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/iso_bib_item/series.rb', line 57

def to_xml(builder)
  builder.series type: type do
    builder.title { title.to_xml builder } if title
    builder.place place if place
    builder.organization organization if organization
    builder.abbreviation { abbreviation.to_xml builder } if abbreviation
    builder.from from if from
    builder.to to if to
    builder.number number if number
    builder.part_number part_number if part_number
  end
end