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

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Automatically extends class-level methods when included.

Parameters:

  • base (Class)


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_keySymbol

Returns the root key for this instance.

Returns:

  • (Symbol)


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.

Returns:

  • (Boolean)


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