Class: Egg::Description
- Inherits:
-
Object
- Object
- Egg::Description
- Defined in:
- lib/egg/description.rb
Instance Attribute Summary collapse
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#payee ⇒ Object
readonly
Returns the value of attribute payee.
-
#territory ⇒ Object
readonly
Returns the value of attribute territory.
Instance Method Summary collapse
-
#initialize(description) ⇒ Description
constructor
A new instance of Description.
Constructor Details
#initialize(description) ⇒ Description
Returns a new instance of Description.
4 5 6 7 8 9 10 11 12 |
# File 'lib/egg/description.rb', line 4 def initialize(description) if m = description.match(/(.{23}) (.{13}) (.{2})?/) # territory (last two chars) is not in recent transactions @payee = m[1].strip.squeeze(' ') @note = m[2].strip @territory = m[3].strip if m[3] else @payee = description end end |
Instance Attribute Details
#note ⇒ Object (readonly)
Returns the value of attribute note.
3 4 5 |
# File 'lib/egg/description.rb', line 3 def note @note end |
#payee ⇒ Object (readonly)
Returns the value of attribute payee.
3 4 5 |
# File 'lib/egg/description.rb', line 3 def payee @payee end |
#territory ⇒ Object (readonly)
Returns the value of attribute territory.
3 4 5 |
# File 'lib/egg/description.rb', line 3 def territory @territory end |