Class: WorkOS::DeprecatedHashWrapper
- Inherits:
-
Hash
- Object
- Hash
- WorkOS::DeprecatedHashWrapper
- Defined in:
- lib/workos/deprecated_hash_wrapper.rb
Overview
A Temporary wrapper class for a Hash, currently the base class for WorOS::DirectoryGroup and WorkOS::DirectoryUser. Makes all the Hash methods available to those classes, but will also emit a deprecation warning whenever any of them are used.
Once we deprecate Hash compatibility, this model can be deleted.
Direct Known Subclasses
Instance Method Summary collapse
- #[](attribute_name) ⇒ Object
-
#replace_without_warning(new_hash) ⇒ Object
call the original implementation of :replace in Hash, so we don’t show the deprecation warning.
Instance Method Details
#[](attribute_name) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/workos/deprecated_hash_wrapper.rb', line 24 def [](attribute_name) usage = "#{object_name}.#{attribute_name}" = "WARNING: The Hash style access for #{class_name} attributes is deprecated and will be removed in a future version. Please use `#{usage}` or equivalent accessor.\n" print_deprecation_warning('[]', ) super(attribute_name.to_sym) end |
#replace_without_warning(new_hash) ⇒ Object
call the original implementation of :replace in Hash, so we don’t show the deprecation warning
20 21 22 |
# File 'lib/workos/deprecated_hash_wrapper.rb', line 20 def replace_without_warning(new_hash) method(:replace).super_method&.call(new_hash) end |