Class: Relaton::Plateau::Stagename
- Inherits:
-
Object
- Object
- Relaton::Plateau::Stagename
- Defined in:
- lib/relaton/plateau/stagename.rb
Instance Attribute Summary collapse
- #abbreviation ⇒ String? readonly
- #content ⇒ String readonly
Instance Method Summary collapse
-
#initialize(content:, abbreviation: nil) ⇒ Stagename
constructor
Initialize the Stagename object.
- #to_asciibib(prefix = "") ⇒ Object
- #to_hash ⇒ Object
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(content:, abbreviation: nil) ⇒ Stagename
Initialize the Stagename object
16 17 18 19 |
# File 'lib/relaton/plateau/stagename.rb', line 16 def initialize(content:, abbreviation: nil) @content = content @abbreviation = abbreviation end |
Instance Attribute Details
#abbreviation ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton/plateau/stagename.rb', line 8 def abbreviation @abbreviation end |
#content ⇒ String (readonly)
5 6 7 |
# File 'lib/relaton/plateau/stagename.rb', line 5 def content @content end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ Object
34 35 36 37 38 39 |
# File 'lib/relaton/plateau/stagename.rb', line 34 def to_asciibib(prefix = "") pref = prefix.empty? ? "stagename" : "#{prefix}.stagename" output = "#{pref}.content:: #{content}\n" output += "#{pref}.abbreviation:: #{abbreviation}\n" if abbreviation output end |
#to_hash ⇒ Object
28 29 30 31 32 |
# File 'lib/relaton/plateau/stagename.rb', line 28 def to_hash hash = { content: content } hash[:abbreviation] = abbreviation if abbreviation hash end |
#to_xml(builder) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/relaton/plateau/stagename.rb', line 21 def to_xml(builder) builder.stagename do |b| b.parent[:abbreviation] = abbreviation if abbreviation b.text content end end |