Class DRb::TimerIdConv::TimerHolder2
In: drb/timeridconv.rb
Parent: Object

Methods

add   fetch   include?   new   peek  

Included Modules

MonitorMixin

Classes and Modules

Class DRb::TimerIdConv::TimerHolder2::InvalidIndexError

Public Class methods

[Source]

# File drb/timeridconv.rb, line 11
      def initialize(timeout=600)
        super()
        @sentinel = Object.new
        @gc = {}
        @curr = {}
        @renew = {}
        @timeout = timeout
        @keeper = keeper
      end

Public Instance methods

[Source]

# File drb/timeridconv.rb, line 21
      def add(obj)
        synchronize do 
          key = obj.__id__
          @curr[key] = obj
          return key
        end
      end

[Source]

# File drb/timeridconv.rb, line 29
      def fetch(key, dv=@sentinel)
        synchronize do 
          obj = peek(key)
          if obj == @sentinel
            return dv unless dv == @sentinel
            raise InvalidIndexError
          end
          @renew[key] = obj # KeepIt
          return obj
        end
      end

[Source]

# File drb/timeridconv.rb, line 41
      def include?(key)
        synchronize do 
          obj = peek(key)
          return false if obj == @sentinel
          true
        end
      end

[Source]

# File drb/timeridconv.rb, line 49
      def peek(key)
        synchronize do 
          return @curr.fetch(key, @renew.fetch(key, @gc.fetch(key, @sentinel)))
        end
      end

[Validate]

ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.