Class: ScoutApm::Config::SampleRateCoercion
- Inherits:
-
Object
- Object
- ScoutApm::Config::SampleRateCoercion
- Defined in:
- lib/scout_apm/config.rb
Instance Method Summary collapse
Instance Method Details
#coerce(val) ⇒ Object
215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/scout_apm/config.rb', line 215 def coerce(val) v = val.to_f # Anything above 1 is assumed a percentage for backwards compat, so convert to a decimal if v > 1 v = v / 100 end if v < 0 || v > 1 v = v.clamp(0, 1) end v end |