class Cartos::Spreadsheet::Month
Constants
- AMOUNT
- CATEGORIES
- CATEGORY
- DATE
- DESCRIPTION
- EARNINGS_TOTAL
- EXPENDINGS_BY_CATEGORY
- EXPENDINGS_TOTAL
Public Class Methods
new(sheet)
click to toggle source
# File lib/cartos/spreadsheet/sheets/month.rb, line 15 def initialize(sheet) @sheet = sheet end
Public Instance Methods
push_category(category)
click to toggle source
# File lib/cartos/spreadsheet/sheets/month.rb, line 26 def push_category(category) push_row CATEGORIES, category formula = Cartos::Google::Sheet::Formulas.new entry_range = @sheet.row_range(AMOUNT, 1, @sheet.last_row(AMOUNT)) category_range = @sheet.row_range(CATEGORY, 1, @sheet.last_row(CATEGORY)) push_row EXPENDINGS_BY_CATEGORY, formula.sum.filter(entry_range, "#{category_range} = \"#{category}\"") end
push_entry(date, amount, description, category)
click to toggle source
# File lib/cartos/spreadsheet/sheets/month.rb, line 19 def push_entry(date, amount, description, category) push_row DATE, date push_row AMOUNT, amount push_row DESCRIPTION, description push_row CATEGORY, category end
push_row(column, value)
click to toggle source
# File lib/cartos/spreadsheet/sheets/month.rb, line 41 def push_row(column, value) @sheet.push_row column, value end
push_summary(expendings_total, earnings_total)
click to toggle source
# File lib/cartos/spreadsheet/sheets/month.rb, line 34 def push_summary(expendings_total, earnings_total) push_row EARNINGS_TOTAL, "Earnings" push_row EARNINGS_TOTAL, earnings_total push_row EXPENDINGS_TOTAL, "Expendings" push_row EXPENDINGS_TOTAL, expendings_total end
save()
click to toggle source
# File lib/cartos/spreadsheet/sheets/month.rb, line 45 def save @sheet.save end