In Files

Parent

Methods

Lockfile::SleepCycle

Attributes

min[R]
max[R]
range[R]
inc[R]

Public Class Methods

new(min, max, inc) click to toggle source
    # File lib/lockfile.rb, line 28
28:       def initialize(min, max, inc)
29:         @min, @max, @inc = Float(min), Float(max), Float(inc)
30:         @range = @max - @min
31:         raise RangeError, "max(#{ @max }) <= min(#{ @min })" if @max <= @min
32:         raise RangeError, "inc(#{ @inc }) > range(#{ @range })" if @inc > @range
33:         raise RangeError, "inc(#{ @inc }) <= 0" if @inc <= 0
34:         raise RangeError, "range(#{ @range }) <= 0" if @range <= 0
35:         s = @min
36:         push(s) and s += @inc while(s <= @max)
37:         self[1] = @max if self[1] < @max
38:         reset
39:       end

Public Instance Methods

next() click to toggle source
    # File lib/lockfile.rb, line 41
41:       def next
42:         ret = self[@idx]
43:         @idx = ((@idx + 1) % self.size)
44:         ret
45:       end
reset() click to toggle source
    # File lib/lockfile.rb, line 47
47:       def reset
48:         @idx = 0
49:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.