Class: Egg::Description

Inherits:
Object
  • Object
show all
Defined in:
lib/egg/description.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#noteObject (readonly)

Returns the value of attribute note.



3
4
5
# File 'lib/egg/description.rb', line 3

def note
  @note
end

#payeeObject (readonly)

Returns the value of attribute payee.



3
4
5
# File 'lib/egg/description.rb', line 3

def payee
  @payee
end

#territoryObject (readonly)

Returns the value of attribute territory.



3
4
5
# File 'lib/egg/description.rb', line 3

def territory
  @territory
end