Class: Datadog::AppSec::RouteNormalizer::RailsRoutePattern::Buffer Private
- Inherits:
-
Object
- Object
- Datadog::AppSec::RouteNormalizer::RailsRoutePattern::Buffer
- Defined in:
- lib/datadog/appsec/route_normalizer/rails_route_pattern.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #add_literal(text) ⇒ Object private
- #add_param(name) ⇒ Object private
- #flush ⇒ Object private
-
#initialize ⇒ Buffer
constructor
private
A new instance of Buffer.
- #to_path ⇒ Object private
Constructor Details
#initialize ⇒ Buffer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Buffer.
126 127 128 129 130 131 |
# File 'lib/datadog/appsec/route_normalizer/rails_route_pattern.rb', line 126 def initialize @segments = [] @text = +"" @params = [] @nameless_param_count = 0 end |
Instance Method Details
#add_literal(text) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
133 134 135 |
# File 'lib/datadog/appsec/route_normalizer/rails_route_pattern.rb', line 133 def add_literal(text) @text << text end |
#add_param(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
137 138 139 |
# File 'lib/datadog/appsec/route_normalizer/rails_route_pattern.rb', line 137 def add_param(name) @params << name end |
#flush ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/datadog/appsec/route_normalizer/rails_route_pattern.rb', line 141 def flush return if @text.empty? && @params.empty? @segments << if @params.empty? RouteText.escape(@text) else render_params(@params) end @text = +"" @params.clear end |
#to_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
154 155 156 157 158 |
# File 'lib/datadog/appsec/route_normalizer/rails_route_pattern.rb', line 154 def to_path flush "/#{@segments.join("/")}" end |