Sha256: 50709d2e04220570f0268cbe3fac441a30d608d5e4564ddbece070c350fec4b5

Contents?: true

Size: 569 Bytes

Versions: 10

Compression:

Stored size: 569 Bytes

Contents

# -*- encoding : utf-8 -*-
# This middleware prepends the names of the trackers passing through it with a prefix
# and an underscore
class Tracksperanto::Middleware::Prefix < Tracksperanto::Middleware::Base
  
  parameter :prefix,  :cast => :string, :desc => "The prefix to apply", :default => "trk_"
  
  def self.action_description
    "Prefix tracker names with text"
  end
  
  def start_tracker_segment(tracker_name)
    prefixed_name = [prefix.gsub(/_$/, ''), tracker_name]
    prefixed_name.reject!{|e| e.empty? }
    super(prefixed_name.join('_'))
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tracksperanto-2.12.0 lib/middleware/prefix.rb
tracksperanto-2.11.3 lib/middleware/prefix.rb
tracksperanto-2.11.2 lib/middleware/prefix.rb
tracksperanto-2.11.1 lib/middleware/prefix.rb
tracksperanto-2.11.0 lib/middleware/prefix.rb
tracksperanto-2.10.0 lib/middleware/prefix.rb
tracksperanto-2.9.9 lib/middleware/prefix.rb
tracksperanto-2.9.8 lib/middleware/prefix.rb
tracksperanto-2.9.7 lib/middleware/prefix.rb
tracksperanto-2.9.6 lib/middleware/prefix.rb