lazy_object: fix __getobj__ signature

This commit is contained in:
Bo Anderson 2025-05-02 01:26:58 +01:00
parent 080ade602a
commit 6403d1379e
No known key found for this signature in database

View File

@ -9,17 +9,15 @@ class LazyObject < Delegator
super(callable) super(callable)
end end
def __getobj__ def __getobj__(&)
return @__getobj__ if defined?(@__getobj__) return @__getobj__ if defined?(@__getobj__)
@__getobj__ = @__callable__.call @__getobj__ = @__callable__.call
end end
private :__getobj__
def __setobj__(callable) def __setobj__(callable)
@__callable__ = callable @__callable__ = callable
end end
private :__setobj__
# Forward to the inner object to make lazy objects type-checkable. # Forward to the inner object to make lazy objects type-checkable.
# #