Module: Mu::Action::MetaPropAdder
- Defined in:
- lib/mu/action.rb
Overview
Internal module that automatically adds a meta property to action classes when they are instantiated. Ensures proper metadata initialization.
Instance Method Summary collapse
Instance Method Details
#inherited(subclass) ⇒ Object
36 37 38 39 |
# File 'lib/mu/action.rb', line 36 def inherited(subclass) super subclass.instance_variable_set(:@meta_prop_added, false) end |
#new ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mu/action.rb', line 25 def new(...) unless @meta_prop_added prop :meta, Hash, default: -> { {} } @meta_prop_added = true end instance = super # Ensure meta is initialized for this specific class instance.send(:initialize_meta) if instance.respond_to?(:initialize_meta, true) instance end |