Class: Tracksperanto::Middleware::Prefix

Inherits:
Base
  • Object
show all
Defined in:
lib/middleware/prefix.rb

Overview

This middleware prepends the names of the trackers passing through it with a prefix and an underscore

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#end_export, #end_tracker_segment, #export_point, inherited, #initialize, #start_export

Methods included from SimpleExport

#just_export

Methods included from ConstName

#const_name, included

Methods included from BlockInit

#initialize

Methods included from Casts

#cast_to_float, #cast_to_int, #cast_to_string, included

Constructor Details

This class inherits a constructor from Tracksperanto::Middleware::Base

Instance Attribute Details

#prefixObject

Returns the value of attribute prefix.



4
5
6
# File 'lib/middleware/prefix.rb', line 4

def prefix
  @prefix
end

Instance Method Details

#start_tracker_segment(tracker_name) ⇒ Object



7
8
9
10
11
# File 'lib/middleware/prefix.rb', line 7

def start_tracker_segment(tracker_name)
  prefixed_name = [prefix.gsub(/_$/, ''), tracker_name]
  prefixed_name.reject!{|e| e.empty? }
  super(prefixed_name.join('_'))
end