timers:适用于事件循环的纯Ruby计时器集合

时间:2021-05-04 20:37:01
【文件属性】:
文件名称:timers:适用于事件循环的纯Ruby计时器集合
文件大小:29KB
文件格式:ZIP
更新时间:2021-05-04 20:37:01
Ruby 计时器 一次性计时器和定期计时器的集合,旨在与事件循环(例如。 安装 将此行添加到您的应用程序的Gemfile中: gem 'timers' 然后执行: $ bundle 或将其自己安装为: $ gem install timers 用法 使用Timers::Group.new创建一个新的计时器组: require 'timers' timers = Timers :: Group . new 使用Timers::Group#after安排在5秒钟后运行的proc: five_second_timer = timers . after ( 5 ) { puts "Take five" } 现在将five_second_timer变量绑定到Timers :: Timer对象。 要取消计时器,请使用Timers::Timer#cancel 安排好计时器后,您可以等待,直到使用
【文件预览】:
timers-master
----.github()
--------workflows()
----gems.rb(198B)
----.rspec(55B)
----spec()
--------timers()
--------spec_helper.rb(541B)
----.gitignore(125B)
----lib()
--------timers()
--------timers.rb(1KB)
----timers.gemspec(534B)
----README.md(4KB)
----.editorconfig(52B)

网友评论