class Reparty::Report

Attributes

color[R]
interval[R]
title[R]

Public Class Methods

new(interval, title) click to toggle source
# File lib/reparty/report.rb, line 7
def initialize(interval, title)
  @interval = interval

  raise "Report: title must be defined" if title.blank?
  @title = title

  @color = "#832701"
end

Public Instance Methods

attach(attachments) click to toggle source
# File lib/reparty/report.rb, line 16
def attach(attachments)
  # Optional
end

Protected Instance Methods

build_daily_area_graph(start_date=DateTime.now.utc) click to toggle source
# File lib/reparty/report.rb, line 26
def build_daily_area_graph(start_date=DateTime.now.utc)
  build_daily_graph(Gruff::Area.new(545), start_date)
end
build_daily_bar_graph(start_date=DateTime.now.utc) click to toggle source
# File lib/reparty/report.rb, line 30
def build_daily_bar_graph(start_date=DateTime.now.utc)
  build_daily_graph(Gruff::Bar.new(545), start_date)
end
build_daily_graph(g, start_date) click to toggle source
# File lib/reparty/report.rb, line 34
def build_daily_graph(g, start_date)
  g.title = @title
  g.labels = Hash[*(1..7).map{|x| [x-1, (start_date - (8-x)).strftime("%-m/%-d")] }.flatten]
  g
end
build_daily_line_graph(start_date=DateTime.now.utc) click to toggle source
# File lib/reparty/report.rb, line 22
def build_daily_line_graph(start_date=DateTime.now.utc)
  build_daily_graph(Gruff::Line.new(545), start_date)
end