Module: Castkit::DataObjectExtensions::Config
- Included in:
- Castkit::DataObject
- Defined in:
- lib/castkit/data_object_extensions/config.rb
Overview
Provides per-class configuration for a Castkit::DataObject, including root key handling, strict mode, and unknown key behavior.
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.
11 12 13 |
# File 'lib/castkit/data_object_extensions/config.rb', line 11 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#root_key ⇒ Symbol
Returns the root key for this instance.
93 94 95 |
# File 'lib/castkit/data_object_extensions/config.rb', line 93 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.
100 101 102 |
# File 'lib/castkit/data_object_extensions/config.rb', line 100 def root_key_set? !self.class.root.to_s.strip.empty? end |