diff options
Diffstat (limited to 'ext/tk/lib/tkafter.rb')
-rw-r--r-- | ext/tk/lib/tkafter.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ext/tk/lib/tkafter.rb b/ext/tk/lib/tkafter.rb index 529b1e6cfb..0572106771 100644 --- a/ext/tk/lib/tkafter.rb +++ b/ext/tk/lib/tkafter.rb @@ -11,7 +11,7 @@ class TkTimer TkCommandNames = ['after'.freeze].freeze - Tk_CBID = ['a'.freeze, '00000'] + Tk_CBID = ['a'.freeze, '00000'].freeze Tk_CBTBL = {} TkCore::INTERP.add_tk_procs('rb_after', 'id', <<-'EOL') @@ -311,6 +311,22 @@ class TkTimer self end + def reset(*reset_args) + restart() if @running + + if @init_proc + @return_value = @init_proc.call(self) + else + @return_value = nil + end + + @current_pos = 0 + @current_args = @init_args + @set_next = false if @in_callback + + self + end + def restart(*restart_args) cancel if @running if restart_args == [] |