Module: Familia::DataType::Settings
- Defined in:
- lib/familia/data_type/settings.rb
Overview
Settings - Instance-level configuration and introspection methods
This module provides instance methods for accessing and managing DataType object configuration, parent relationships, and serialization.
Key features:
- Parent object relationship management
- URI and database configuration
- Serialization method delegation
- Type introspection
Instance Attribute Summary collapse
-
#keystring ⇒ Object
readonly
Returns the value of attribute keystring.
-
#logical_database ⇒ Object
readonly
Returns the value of attribute logical_database.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #class? ⇒ Boolean
- #dump_method ⇒ Object
- #load_method ⇒ Object
- #parent ⇒ Object
- #parent=(value) ⇒ Object
- #parent? ⇒ Boolean
- #parent_class? ⇒ Boolean
- #parent_instance? ⇒ Boolean
-
#url ⇒ Object
Returns the value of attribute uri.
Instance Attribute Details
#keystring ⇒ Object (readonly)
Returns the value of attribute keystring.
17 18 19 |
# File 'lib/familia/data_type/settings.rb', line 17 def keystring @keystring end |
#logical_database ⇒ Object (readonly)
Returns the value of attribute logical_database.
17 18 19 |
# File 'lib/familia/data_type/settings.rb', line 17 def logical_database @logical_database end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
17 18 19 |
# File 'lib/familia/data_type/settings.rb', line 17 def opts @opts end |
#uri ⇒ Object
Returns the value of attribute uri.
18 19 20 |
# File 'lib/familia/data_type/settings.rb', line 18 def uri @uri end |
Instance Method Details
#class? ⇒ Boolean
22 23 24 |
# File 'lib/familia/data_type/settings.rb', line 22 def class? !@opts[:class].to_s.empty? && @opts[:class].is_a?(Familia) end |
#dump_method ⇒ Object
87 88 89 |
# File 'lib/familia/data_type/settings.rb', line 87 def dump_method self.class.dump_method end |
#load_method ⇒ Object
91 92 93 |
# File 'lib/familia/data_type/settings.rb', line 91 def load_method self.class.load_method end |
#parent ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/familia/data_type/settings.rb', line 38 def parent # Return cached ParentDefinition if available return @parent if @parent # Return class-level parent if no instance parent return self.class.parent unless @parent_ref # Create ParentDefinition dynamically from stored reference. # This ensures we get the current identifier value (available after initialization) # rather than a stale nil value from initialization time. Cannot cache due to frozen object. Horreum::ParentDefinition.from_parent(@parent_ref) end |
#parent=(value) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/familia/data_type/settings.rb', line 51 def parent=(value) case value when Horreum::ParentDefinition @parent = value when nil @parent = nil @parent_ref = nil else # Store parent instance reference for lazy ParentDefinition creation. # During initialization, the parent's identifier may not be available yet, # so we defer ParentDefinition creation until first access for memory efficiency. # Note: @parent_ref is not cleared after use because DataType objects are frozen. @parent_ref = value @parent = nil # Will be created dynamically in parent method end end |
#parent? ⇒ Boolean
34 35 36 |
# File 'lib/familia/data_type/settings.rb', line 34 def parent? parent_class? || parent_instance? end |
#parent_class? ⇒ Boolean
30 31 32 |
# File 'lib/familia/data_type/settings.rb', line 30 def parent_class? parent.is_a?(Class) && parent.ancestors.include?(Familia::Horreum) end |
#parent_instance? ⇒ Boolean
26 27 28 |
# File 'lib/familia/data_type/settings.rb', line 26 def parent_instance? parent&.is_a?(Horreum::ParentDefinition) end |
#url ⇒ Object
Returns the value of attribute uri.
20 21 22 |
# File 'lib/familia/data_type/settings.rb', line 20 def uri @uri end |