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)


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

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

Instance Attribute Details

#abbreviationString, NilClass (readonly)

Returns:

  • (String, NilClass)


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

def abbreviation
  @abbreviation
end

#valueString (readonly)

Returns:

  • (String)


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

def value
  @value
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


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

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

#to_xml(builder) ⇒ Object

Parameters:

  • (Nokogiri::XML::Builder)


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

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