Socket
Book a DemoInstallSign in
Socket

cadence

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cadence

0.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

h1. Cadence

Track counts and compute rate of iteration. Set up callbacks for various intervals such as @every@ n increments or every n @ticks@.

h2. Sample

require 'lib/cadence'

data = (1..100).to_a

computer = Cadence::Computer.new do |c|
  c.every 5 do
    p [:every, 5, n]
  end
  
  c.for(:tens).every do
    p [:tens, :every, n]
  end
  
  c.twenties.every 2 do
    p [:twenties, :every, 2, n]
  end
  
  c.ticks 1 do
    p [:tock, n, timestamp]
  end
end

computer.start do |c|
  data.each do |n|
    c.next
    c.tens.next if n % 10 == 0
    p [:n, n]
    sleep 0.02
  end
end

h2. License

MIT

h2. Copyright

Copyright (C) 2010 Matt Todd.

FAQs

Package last updated on 01 Sep 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.