Class: Script::Interval

Inherits:
Object
  • Object
show all
Defined in:
lib/script.rb

Overview

in Trigger

Instance Method Summary collapse

Constructor Details

#initialize(toplevel, n, &block) ⇒ Interval

Returns a new instance of Interval.



63
64
65
66
67
68
# File 'lib/script.rb', line 63

def initialize(toplevel, n, &block)
  @toplevel = toplevel
  @n = n
  @m = 0
  @prog = Prog.new(@toplevel, &block)
end

Instance Method Details

#doitObject



70
71
72
73
74
75
76
# File 'lib/script.rb', line 70

def doit
  @m += 1
  if @m == @n
    @prog.doit
    @m = 0
  end
end