Sha256: d2c507363ca081c1ee4f907a52b79b69b6248a34a564fd08c1281ea715500318
Contents?: true
Size: 936 Bytes
Versions: 1
Compression:
Stored size: 936 Bytes
Contents
require 'sinatra/base' require 'active_record' require 'haml' require 'gruff' require './lib/mdg/db' require './lib/mdg/deed' require './lib/mdg/timestamp' module Mdg class Application < Sinatra::Base configure do DB.prepare end configure :development do require 'sinatra/reloader' register Sinatra::Reloader end get '/' do redirect '/mdg' end get '/mdg' do @deeds = Deed.all g = Gruff::Line.new g.title = 'My Graph' labels = {} n = 0 @deeds.each do |deed| g.data(deed.content, deed.timestamps.map(&:totaltime)) deed.timestamps.each do |t| date = t.created_at.strftime('%y/%m/%d') unless labels.value?(date) labels.store(n, date) n += 1 end end end g.labels = labels g.write('./lib/public/my_graph.png') haml :index end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mdg-1.0.1 | lib/application.rb |