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], }.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
77 78 79 80 81 |
# File 'lib/labkit/fields.rb', line 77 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
87 88 89 |
# File 'lib/labkit/fields.rb', line 87 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
95 96 97 |
# File 'lib/labkit/fields.rb', line 95 def standard_field_for(deprecated_field) all[deprecated_field.to_s] end |