module R3Status

Constants

AsyncBlock

Alias for Blocks::Async

BatteryBlock

Alias for Blocks::Power

Block

Alias for Blocks::Base

KeyboardLayoutBlock

Alias for Blocks::KeyboardLayout

MOUSE_BUTTONS

Specifies the mouse buttons and their IDs.

ShellBlock

Alias for Blocks::Shell

StaticBlock

Alias for Blocks::Base

TimeBlock

Alias for Blocks::Clock

VolumeBlock

Alias for Blocks::Volume

Public Instance Methods

loop_with_interval(secs) { || ... } click to toggle source

Loops over the given block at the specified interval. The interval is the time between yields, not between a yield’s ends the next’s start.

# File lib/r3status.rb, line 10
def loop_with_interval secs
  loop do
    start = Time.now
    yield
    interval = secs - (Time.now - start)
    sleep(interval) if interval > 0
  end
end