Class: IsoBibItem::IsoDocumentStatus

Inherits:
DocumentStatus show all
Defined in:
lib/iso_bib_item/iso_document_status.rb

Overview

ISO Document status.

Instance Attribute Summary collapse

Attributes inherited from DocumentStatus

#status

Instance Method Summary collapse

Constructor Details

#initialize(status: nil, stage: nil, substage: nil, iteration: nil) ⇒ IsoDocumentStatus

Returns a new instance of IsoDocumentStatus.

Parameters:

  • status (String, NilClass) (defaults to: nil)
  • stage (String, NilClass) (defaults to: nil)
  • substage (String, NilClass) (defaults to: nil)
  • iteration (Integer, NilClass) (defaults to: nil)

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
# File 'lib/iso_bib_item/iso_document_status.rb', line 44

def initialize(status: nil, stage: nil, substage: nil, iteration: nil)
  raise ArgumentError, 'status or stage is required' unless status || stage
  super LocalizedString.new(status)
  @stage     = stage
  @substage  = substage
  @iteration = iteration
end

Instance Attribute Details

#iterationInteger, NilClass (readonly)

Returns:

  • (Integer, NilClass)


38
39
40
# File 'lib/iso_bib_item/iso_document_status.rb', line 38

def iteration
  @iteration
end

#stageString, NilClass (readonly)

Returns:

  • (String, NilClass)


32
33
34
# File 'lib/iso_bib_item/iso_document_status.rb', line 32

def stage
  @stage
end

#substageString, NilClass (readonly)

Returns:

  • (String, NilClass)


35
36
37
# File 'lib/iso_bib_item/iso_document_status.rb', line 35

def substage
  @substage
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nkogiri::XML::Builder)


53
54
55
56
57
58
59
60
61
62
63
# File 'lib/iso_bib_item/iso_document_status.rb', line 53

def to_xml(builder)
  if stage.nil? || stage.empty?
    super
  else
    builder.status do
      builder.stage stage
      builder.substage substage if substage
      builder.iteration iteration if iteration
    end
  end
end