Class: Doing::Entry
Overview
An individual changelog item
Instance Attribute Summary collapse
-
#prefix ⇒ Object
writeonly
Sets the attribute prefix.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #clean(string) ⇒ Object
-
#initialize(string, type, prefix: false) ⇒ Entry
constructor
A new instance of Entry.
- #print_prefix ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(string, type, prefix: false) ⇒ Entry
Returns a new instance of Entry.
10 11 12 13 14 |
# File 'lib/doing/changelog/entry.rb', line 10 def initialize(string, type, prefix: false) @string = string @type = type @prefix = prefix end |
Instance Attribute Details
#prefix=(value) ⇒ Object (writeonly)
Sets the attribute prefix
8 9 10 |
# File 'lib/doing/changelog/entry.rb', line 8 def prefix=(value) @prefix = value end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
6 7 8 |
# File 'lib/doing/changelog/entry.rb', line 6 def string @string end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/doing/changelog/entry.rb', line 6 def type @type end |
Instance Method Details
#clean(string) ⇒ Object
16 17 18 |
# File 'lib/doing/changelog/entry.rb', line 16 def clean(string) string.gsub(/\|/, '\|') end |
#print_prefix ⇒ Object
20 21 22 |
# File 'lib/doing/changelog/entry.rb', line 20 def print_prefix @prefix ? "#{@type}: " : '' end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/doing/changelog/entry.rb', line 24 def to_s "- #{print_prefix}#{clean(@string)}" end |