Module: Labkit::Fields::Deprecated
- Defined in:
- lib/labkit/fields.rb
Constant Summary collapse
- MAPPINGS =
This module tracks deprecated field names and maps them to their standard replacements. These mappings are used by the field scanner to identify and track usage of deprecated fields in the codebase.
{ Fields::GL_USER_ID => %w[user_id userid], Fields::HTTP_STATUS_CODE => %w[status_code extra.status status_text], }.freeze
Class Method Summary collapse
-
.all ⇒ Hash{String => String}
Get all deprecated fields as a lookup hash.
-
.deprecated?(field_name) ⇒ Boolean
Check if a field is deprecated.
-
.standard_field_for(deprecated_field) ⇒ String?
Get the standard field for a deprecated field.
Class Method Details
.all ⇒ Hash{String => String}
Get all deprecated fields as a lookup hash
108 109 110 111 112 |
# File 'lib/labkit/fields.rb', line 108 def all @all ||= MAPPINGS.each_with_object({}) do |(key, values), result| values.each { |v| result[v] = key } end end |
.deprecated?(field_name) ⇒ Boolean
Check if a field is deprecated
118 119 120 |
# File 'lib/labkit/fields.rb', line 118 def deprecated?(field_name) all.key?(field_name.to_s) end |
.standard_field_for(deprecated_field) ⇒ String?
Get the standard field for a deprecated field
126 127 128 |
# File 'lib/labkit/fields.rb', line 126 def standard_field_for(deprecated_field) all[deprecated_field.to_s] end |