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
117 118 119 120 121 |
# File 'lib/labkit/fields.rb', line 117 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
127 128 129 |
# File 'lib/labkit/fields.rb', line 127 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
135 136 137 |
# File 'lib/labkit/fields.rb', line 135 def standard_field_for(deprecated_field) all[deprecated_field.to_s] end |