lib/middleware/prefix.rb in tracksperanto-2.9.5 vs lib/middleware/prefix.rb in tracksperanto-2.9.6
- old
+ new
@@ -1,10 +1,14 @@
# -*- 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
- attr_accessor :prefix
- cast_to_string :prefix
+
+ 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('_'))