class Miser::Report

Public Class Methods

new(movements, date) click to toggle source
# File lib/miser/report.rb, line 6
def initialize(movements, date)
  @movements = movements
  @date = date
end

Public Instance Methods

subject() click to toggle source
# File lib/miser/report.rb, line 15
def subject
  "Miser report for #{@date.to_date}"
end
text() click to toggle source
# File lib/miser/report.rb, line 19
    def text
<<-TEXT
Total Spent: #{total_spent}

#{@movements.join("\n")}
TEXT
    end
total_spent() click to toggle source
# File lib/miser/report.rb, line 11
def total_spent
  total.abs
end

Private Instance Methods

total() click to toggle source
# File lib/miser/report.rb, line 28
def total
  @movements.reduce(:+) || 0
end