Class: RelatonBib::DocumentStatus
- Defined in:
- lib/relaton_bib/document_status.rb
Overview
Document status.
Defined Under Namespace
Classes: Stage
Instance Attribute Summary collapse
- #iteration ⇒ String? readonly
- #stage ⇒ RelatonBib::DocumentStatus::Stage readonly
- #substage ⇒ RelatonBib::DocumentStatus::Stage? readonly
Instance Method Summary collapse
-
#initialize(stage:, substage: nil, iteration: nil) ⇒ DocumentStatus
constructor
A new instance of DocumentStatus.
- #to_asciibib(prefix = "") ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(stage:, substage: nil, iteration: nil) ⇒ DocumentStatus
Returns a new instance of DocumentStatus.
18 19 20 21 22 |
# File 'lib/relaton_bib/document_status.rb', line 18 def initialize(stage:, substage: nil, iteration: nil) @stage = stage_new stage @substage = stage_new substage @iteration = iteration end |
Instance Attribute Details
#iteration ⇒ String? (readonly)
13 14 15 |
# File 'lib/relaton_bib/document_status.rb', line 13 def iteration @iteration end |
#stage ⇒ RelatonBib::DocumentStatus::Stage (readonly)
7 8 9 |
# File 'lib/relaton_bib/document_status.rb', line 7 def stage @stage end |
#substage ⇒ RelatonBib::DocumentStatus::Stage? (readonly)
10 11 12 |
# File 'lib/relaton_bib/document_status.rb', line 10 def substage @substage end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ String
44 45 46 47 48 49 50 |
# File 'lib/relaton_bib/document_status.rb', line 44 def to_asciibib(prefix = "") pref = prefix.empty? ? prefix : "#{prefix}." out = "#{pref}docstatus.stage:: #{stage.value}\n" out += "#{pref}docstatus.substage:: #{substage.value}\n" if substage out += "#{pref}docstatus.iteration:: #{iteration}\n" if iteration out end |
#to_hash ⇒ Hash
35 36 37 38 39 40 |
# File 'lib/relaton_bib/document_status.rb', line 35 def to_hash hash = { "stage" => stage.to_hash } hash["substage"] = substage.to_hash if substage hash["iteration"] = iteration if iteration hash end |
#to_xml(builder) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/relaton_bib/document_status.rb', line 25 def to_xml(builder) builder.status do # FormattedString.instance_method(:to_xml).bind(status).call builder builder.stage { |b| stage.to_xml b } builder.substage { |b| substage.to_xml b } if substage builder.iteration iteration unless iteration.to_s.empty? end end |