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:

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


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

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

Instance Attribute Details

#abbreviationString? (readonly)

Returns:

  • (String, nil)


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

def abbreviation
  @abbreviation
end

#valueString (readonly)

Returns:

  • (String)


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

def value
  @value
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


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

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

#to_xml(builder) ⇒ Object

Parameters:

  • (Nokogiri::XML::Builder)


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

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