Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/lutaml/model/runtime_compatibility.rb
Overview
Opal's Module#prepend raises "Prepending a module multiple times is not supported" when a module is already in the target's ancestor chain. MRI's prepend is idempotent in that case (no-op, no error).
Our top-level lib files (lib/lutaml/model.rb, lib/lutaml/xml.rb) can be re-evaluated under Opal's eager loader, which would trigger the raise on the second pass. Align Opal with MRI by making prepend a no-op when the module is already present.
Instance Method Summary collapse
Instance Method Details
#__lm_original_prepend__ ⇒ Object
137 |
# File 'lib/lutaml/model/runtime_compatibility.rb', line 137 alias_method :__lm_original_prepend__, :prepend |
#prepend(mod) ⇒ Object
139 140 141 |
# File 'lib/lutaml/model/runtime_compatibility.rb', line 139 def prepend(mod) __lm_original_prepend__(mod) unless self <= mod end |