Module: Analytics

Defined in:
lib/analytics.rb

Defined Under Namespace

Classes: FetchMainGatherData, Util

Constant Summary collapse

DB =

connect to mysql

'analytics'

Class Method Summary collapse

Class Method Details

.clientObject



18
19
20
# File 'lib/analytics.rb', line 18

def self.client
    @client
end

.closeObject



14
15
16
17
# File 'lib/analytics.rb', line 14

def self.close
    @stmt.close
    @client.close
end

.gather_day_visitorObject

gather day visitor data



25
26
27
28
29
30
# File 'lib/analytics.rb', line 25

def self.gather_day_visitor
    Util.gather_data{|site_id|
        gatherer = FetchMainGatherData.new(site_id)
        gatherer.gatherDayVisitor
    }
end

.gather_dic_visitor(gather_table, column_name) ⇒ Object

gather visitor data using dictionary group



39
40
41
42
43
44
# File 'lib/analytics.rb', line 39

def self.gather_dic_visitor gather_table,column_name
    Util.gather_data{|site_id|
        gatherer = FetchMainGatherData.new(site_id)
        gatherer.gatherDicDayVisitor gather_table,column_name
    }
end

.gather_hour_visitorObject

gather hour visitor data



32
33
34
35
36
37
# File 'lib/analytics.rb', line 32

def self.gather_hour_visitor
    Util.gather_data{|site_id|
        gatherer = FetchMainGatherData.new(site_id)
        gatherer.gatherHourVisitor
    }
end

.initObject



9
10
11
12
13
# File 'lib/analytics.rb', line 9

def self.init
    @client=Mysql.new("localhost", "root",nil,DB,nil,'/tmp/mysql.sock')
    @client.autocommit(true)
    @stmt = @client.stmt_init
end

.stmtObject



21
22
23
# File 'lib/analytics.rb', line 21

def self.stmt
    @stmt
end