Class: Analytic::Config
- Inherits:
-
Object
- Object
- Analytic::Config
- Defined in:
- lib/analytic/config.rb
Instance Attribute Summary collapse
- #connects_to ⇒ Hash?
- #ip_v4_mask ⇒ Integer
- #ip_v6_mask ⇒ Integer
- #middleware ⇒ Array<Rack::Middleware>
- #params ⇒ Array<Symbol>
- #time_zone ⇒ ActiveSupport::TimeZone
Instance Method Summary collapse
- #connects_to? ⇒ Boolean
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #ip_v4_mask? ⇒ Boolean
- #ip_v6_mask? ⇒ Boolean
- #use(*args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Config
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_to ⇒ Hash?
31 32 33 |
# File 'lib/analytic/config.rb', line 31 def connects_to @connects_to end |
#ip_v4_mask ⇒ Integer
17 18 19 |
# File 'lib/analytic/config.rb', line 17 def ip_v4_mask @ip_v4_mask end |
#ip_v6_mask ⇒ Integer
24 25 26 |
# File 'lib/analytic/config.rb', line 24 def ip_v6_mask @ip_v6_mask end |
#middleware ⇒ Array<Rack::Middleware>
35 36 37 |
# File 'lib/analytic/config.rb', line 35 def middleware @middleware end |
#params ⇒ Array<Symbol>
42 43 44 |
# File 'lib/analytic/config.rb', line 42 def params @params end |
#time_zone ⇒ ActiveSupport::TimeZone
10 11 12 |
# File 'lib/analytic/config.rb', line 10 def time_zone @time_zone end |
Instance Method Details
#connects_to? ⇒ Boolean
63 64 65 |
# File 'lib/analytic/config.rb', line 63 def connects_to? @connects_to.present? end |
#ip_v4_mask? ⇒ Boolean
53 54 55 |
# File 'lib/analytic/config.rb', line 53 def ip_v4_mask? @ip_v4_mask.present? end |
#ip_v6_mask? ⇒ Boolean
58 59 60 |
# File 'lib/analytic/config.rb', line 58 def ip_v6_mask? @ip_v6_mask.present? end |
#use(*args, &block) ⇒ Object
68 69 70 |
# File 'lib/analytic/config.rb', line 68 def use(*args, &block) middleware << [args, block] end |