Class: Datadog::Tracing::Contrib::StatusRangeEnvParser
- Inherits:
-
Object
- Object
- Datadog::Tracing::Contrib::StatusRangeEnvParser
- Defined in:
- lib/datadog/tracing/contrib/status_range_env_parser.rb
Overview
Parsing status range from environment variable
Class Method Summary collapse
Class Method Details
.call(value) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/datadog/tracing/contrib/status_range_env_parser.rb', line 9 def call(value) [].tap do |array| value.split(',').each do |e| next unless e v = e.split('-') case v.length when 0 then next when 1 then array << Integer(v.first) when 2 then array << (Integer(v.first)..Integer(v.last)) else Datadog.logger.debug( "Invalid error_status_codes configuration: Unable to parse #{value}, containing #{v}." ) next end end end end |