Class: RVGP::Journal::Posting::Tag
- Inherits:
-
Object
- Object
- RVGP::Journal::Posting::Tag
- Defined in:
- lib/rvgp/journal/posting.rb
Overview
This class represents a key, or key/value tag, within a journal. These tags can be affixed to transfers and postings. And, are pretty simple, comprising of a key and optionally, a value.
Instance Attribute Summary collapse
-
#key ⇒ String
readonly
The label of this tag.
-
#value ⇒ String
readonly
The value of this tag.
Class Method Summary collapse
-
.from_s(str) ⇒ Tag
Parse the provided string, into a Tag object.
Instance Method Summary collapse
-
#initialize(key, value = nil) ⇒ Tag
constructor
Create a tag from it’s constituent parts.
-
#to_s ⇒ String
Serialize this tag, to a string.
Constructor Details
#initialize(key, value = nil) ⇒ Tag
Create a tag from it’s constituent parts
64 65 66 67 |
# File 'lib/rvgp/journal/posting.rb', line 64 def initialize(key, value = nil) @key = key @value = value end |
Instance Attribute Details
#key ⇒ String (readonly)
The label of this tag
58 59 60 |
# File 'lib/rvgp/journal/posting.rb', line 58 def key @key end |
#value ⇒ String (readonly)
The value of this tag
58 59 60 |
# File 'lib/rvgp/journal/posting.rb', line 58 def value @value end |
Class Method Details
Instance Method Details
#to_s ⇒ String
Serialize this tag, to a string
71 72 73 |
# File 'lib/rvgp/journal/posting.rb', line 71 def to_s value ? [key, value].join(': ') : key end |