Module: Serega::SeregaPlugins::HideNil
- Defined in:
- lib/serega/plugins/hide_nil/hide_nil.rb
Overview
Plugin adds :hide_nil
option to attributes to delete them from final result
if value is nil
Defined Under Namespace
Modules: AttributeInstanceMethods, CheckAttributeParamsInstanceMethods, SeregaObjectSerializerInstanceMethods Classes: CheckOptHideNil
Class Method Summary collapse
-
.after_load_plugin(serializer_class, **opts) ⇒ void
Adds config options and runs other callbacks after plugin was loaded.
-
.load_plugin(serializer_class, **_opts) ⇒ void
Applies plugin code to specific serializer.
-
.plugin_name ⇒ Symbol
Plugin name.
Class Method Details
.after_load_plugin(serializer_class, **opts) ⇒ void
This method returns an undefined value.
Adds config options and runs other callbacks after plugin was loaded
37 38 39 |
# File 'lib/serega/plugins/hide_nil/hide_nil.rb', line 37 def self.after_load_plugin(serializer_class, **opts) serializer_class.config.attribute_keys << :hide_nil end |
.load_plugin(serializer_class, **_opts) ⇒ void
This method returns an undefined value.
Applies plugin code to specific serializer
23 24 25 26 27 |
# File 'lib/serega/plugins/hide_nil/hide_nil.rb', line 23 def self.load_plugin(serializer_class, **_opts) serializer_class::SeregaAttribute.include(AttributeInstanceMethods) serializer_class::CheckAttributeParams.include(CheckAttributeParamsInstanceMethods) serializer_class::SeregaObjectSerializer.include(SeregaObjectSerializerInstanceMethods) end |
.plugin_name ⇒ Symbol
Returns Plugin name.
11 12 13 |
# File 'lib/serega/plugins/hide_nil/hide_nil.rb', line 11 def self.plugin_name :hide_nil end |