Module: BetterAuth::Telemetry::Detectors::Runtime
- Defined in:
- lib/better_auth/telemetry/detectors/runtime.rb
Overview
Runtime detector. Returns a small hash describing the Ruby interpreter currently executing the host application.
This is the Ruby-specific replacement for upstream’s ‘detect-runtime.ts`, which classified Node, Deno, Bun, Cloudflare Workers, and other JavaScript runtimes. The Ruby port is server-only, so all of those branches collapse into a single `“ruby”` case. The `:engine` field preserves enough information for telemetry consumers to distinguish MRI, JRuby, TruffleRuby, etc.
The whole detector is wrapped in ‘rescue StandardError` so a surprise from `RUBY_VERSION`/`RUBY_ENGINE` (very unlikely, but possible under exotic patched interpreters) cannot bubble out of the init payload composition in BetterAuth::Telemetry.create.
Class Method Summary collapse
-
.call ⇒ Hash{Symbol => String, nil}
Hash with ‘:name`, `:version`, and `:engine` keys.
Class Method Details
.call ⇒ Hash{Symbol => String, nil}
Returns hash with ‘:name`, `:version`, and `:engine` keys. `:name` is always `“ruby”`. `:version` is `RUBY_VERSION`. `:engine` is `RUBY_ENGINE` when defined, otherwise the literal string `“ruby”`.
33 34 35 36 37 38 39 40 41 |
# File 'lib/better_auth/telemetry/detectors/runtime.rb', line 33 def call { name: "ruby", version: RUBY_VERSION, engine: defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby" } rescue {name: "ruby", version: nil, engine: nil} end |