Module: Castkit::Ext::DataObject::Serialization
- Included in:
- DataObject
- Defined in:
- lib/castkit/ext/data_object/serialization.rb
Overview
Provides per-class serialization configuration for Castkit::Dataobject, including root key handling and ignore rules.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
Automatically extends class-level methods when included.
Instance Method Summary collapse
-
#root_key ⇒ Symbol
Returns the root key for this instance.
-
#root_key_set? ⇒ Boolean
Whether a root key is configured for this instance.
Class Method Details
.included(base) ⇒ Object
Automatically extends class-level methods when included.
12 13 14 |
# File 'lib/castkit/ext/data_object/serialization.rb', line 12 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#root_key ⇒ Symbol
Returns the root key for this instance.
48 49 50 |
# File 'lib/castkit/ext/data_object/serialization.rb', line 48 def root_key self.class.root.to_s.strip.to_sym end |
#root_key_set? ⇒ Boolean
Whether a root key is configured for this instance.
55 56 57 |
# File 'lib/castkit/ext/data_object/serialization.rb', line 55 def root_key_set? !self.class.root.to_s.strip.empty? end |