Class: Analytic::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/analytic/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



44
45
46
47
48
49
50
# File 'lib/analytic/config.rb', line 44

def initialize
  @time_zone = Time.zone
  @ip_v4_mask = 24 # e.g. 255.255.255.255 => '255.255.255.0/255.255.255.0'
  @ip_v6_mask = 48 # e.g. 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' => 'ffff:ffff:ffff:0000:0000:0000:0000:0000'
  @middleware = []
  @params = %i[utm_source utm_medium utm_campaign utm_content utm_term ref source]
end

Instance Attribute Details

#connects_toHash?

Returns:

  • (Hash, nil)


31
32
33
# File 'lib/analytic/config.rb', line 31

def connects_to
  @connects_to
end

#ip_v4_maskInteger

Returns:

  • (Integer)


17
18
19
# File 'lib/analytic/config.rb', line 17

def ip_v4_mask
  @ip_v4_mask
end

#ip_v6_maskInteger

Returns:

  • (Integer)


24
25
26
# File 'lib/analytic/config.rb', line 24

def ip_v6_mask
  @ip_v6_mask
end

#middlewareArray<Rack::Middleware>

Returns:

  • (Array<Rack::Middleware>)


35
36
37
# File 'lib/analytic/config.rb', line 35

def middleware
  @middleware
end

#paramsArray<Symbol>

Returns:

  • (Array<Symbol>)


42
43
44
# File 'lib/analytic/config.rb', line 42

def params
  @params
end

#time_zoneActiveSupport::TimeZone

Returns:

  • (ActiveSupport::TimeZone)


10
11
12
# File 'lib/analytic/config.rb', line 10

def time_zone
  @time_zone
end

Instance Method Details

#connects_to?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/analytic/config.rb', line 63

def connects_to?
  @connects_to.present?
end

#ip_v4_mask?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/analytic/config.rb', line 53

def ip_v4_mask?
  @ip_v4_mask.present?
end

#ip_v6_mask?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/analytic/config.rb', line 58

def ip_v6_mask?
  @ip_v6_mask.present?
end

#use(*args, &block) ⇒ Object

Parameters:

  • middleware (Rack::Middleware)


68
69
70
# File 'lib/analytic/config.rb', line 68

def use(*args, &block)
  middleware << [args, block]
end