Module: Charted

Defined in:
lib/charted.rb,
lib/charted/app.rb,
lib/charted/model.rb,
lib/charted/config.rb,
lib/charted/command.rb,
lib/charted/version.rb

Defined Under Namespace

Modules: Endable, HasVisitor Classes: App, Command, Config, Conversion, Event, ExitError, Experiment, Migrate, Site, Visit, Visitor

Constant Summary collapse

GEOIP =
GeoIP.new("#{File.dirname(__FILE__)}/../geoip.dat")
JS_FILE =
"#{File.dirname(__FILE__)}/../public/charted/script.js"
VERSION =
'0.1.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.databaseObject

Returns the value of attribute database.



3
4
5
# File 'lib/charted/config.rb', line 3

def database
  @database
end

Class Method Details

.configObject



12
13
14
# File 'lib/charted/config.rb', line 12

def config
  @config ||= Config.new
end

.configure {|self.config| ... } ⇒ Object

Yields:



5
6
7
8
9
10
# File 'lib/charted/config.rb', line 5

def configure
  yield self.config
  Pony.options = config.email_options if !config.email_options.nil?
  Charted.database = Sequel.connect(config.db_options)
  require_relative 'model'
end

.next_month(date, delta = 1) ⇒ Object



28
29
30
31
32
# File 'lib/charted.rb', line 28

def self.next_month(date, delta=1)
  date = Date.new(date.year, date.month, 1)
  delta.times { date = Date.new((date + 32).year, (date + 32).month, 1) }
  date
end

.prev_month(date, delta = 1) ⇒ Object



22
23
24
25
26
# File 'lib/charted.rb', line 22

def self.prev_month(date, delta=1)
  date = Date.new(date.year, date.month, 1)
  delta.times { date = Date.new((date - 1).year, (date - 1).month, 1) }
  date
end