Class: RelatonBib::DocumentStatus::Stage

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_bib/document_status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, abbreviation: nil) ⇒ Stage

Returns a new instance of Stage.

Parameters:

  • abbreviation (String, NilClass) (defaults to: nil)


72
73
74
75
# File 'lib/relaton_bib/document_status.rb', line 72

def initialize(value:, abbreviation: nil)
  @value = value
  @abbreviation = abbreviation
end

Instance Attribute Details

#abbreviationString, NilClass (readonly)

Returns:

  • (String, NilClass)


68
69
70
# File 'lib/relaton_bib/document_status.rb', line 68

def abbreviation
  @abbreviation
end

#valueString (readonly)

Returns:

  • (String)


65
66
67
# File 'lib/relaton_bib/document_status.rb', line 65

def value
  @value
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


84
85
86
87
88
# File 'lib/relaton_bib/document_status.rb', line 84

def to_hash
  hash = { "value" => value }
  hash["abbreviation"] = abbreviation if abbreviation
  hash
end

#to_xml(builder) ⇒ Object

Parameters:

  • (Nokogiri::XML::Builder)


78
79
80
81
# File 'lib/relaton_bib/document_status.rb', line 78

def to_xml(builder)
  builder.parent[:abbreviation] = abbreviation if abbreviation
  builder.text value
end