File: iron_ruby.rb

package info (click to toggle)
ruby-ref 1.0.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 332 kB
  • ctags: 186
  • sloc: ruby: 1,107; java: 92; makefile: 2
file content (14 lines) | stat: -rw-r--r-- 346 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Ref
  class WeakReference < Reference
  # This implementation of a weak reference wraps the System::WeakReference class
  # that comes with IronRuby.
    def initialize(obj) #:nodoc:
      @referenced_object_id = obj.__id__
      @ref = ::System::WeakReference.new(obj)
    end

    def object #:nodoc:
      @ref.target
    end
  end
end