class Wref::Implementations::Ref

Public Class Methods

new(object) click to toggle source
# File lib/wref/implementations/ref.rb, line 2
def initialize(object)
  require "ref"
  @ref = ::Ref::WeakReference.new(object)
end

Public Instance Methods

alive?() click to toggle source
# File lib/wref/implementations/ref.rb, line 17
def alive?
  if @ref.object
    return true
  else
    return false
  end
end
get() click to toggle source
# File lib/wref/implementations/ref.rb, line 7
def get
  @ref.object
end
get!() click to toggle source
# File lib/wref/implementations/ref.rb, line 11
def get!
  object = @ref.object
  raise Wref::Recycled unless object
  return object
end