Class: WeakRef

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/model/runtime_compatibility.rb

Defined Under Namespace

Classes: RefError

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ WeakRef

Returns a new instance of WeakRef.



103
104
105
# File 'lib/lutaml/model/runtime_compatibility.rb', line 103

def initialize(obj)
  @__target__ = obj
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object

Minimal method_missing so the WeakRef quacks like its target for the Store's index lookups.



117
118
119
# File 'lib/lutaml/model/runtime_compatibility.rb', line 117

def method_missing(name, *, &)
  @__target__.public_send(name, *, &)
end

Instance Method Details

#__getobj__Object



107
108
109
# File 'lib/lutaml/model/runtime_compatibility.rb', line 107

def __getobj__
  @__target__
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


121
122
123
# File 'lib/lutaml/model/runtime_compatibility.rb', line 121

def respond_to_missing?(name, include_private = false)
  @__target__.respond_to?(name, include_private)
end

#weakref_alive?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/lutaml/model/runtime_compatibility.rb', line 111

def weakref_alive?
  true
end