Module: Omglog

Defined in:
lib/osx.rb,
lib/linux.rb,
lib/omglog.rb

Defined Under Namespace

Classes: Base, Linux, OSX

Constant Summary collapse

VERSION =
'0.0.8'

Class Method Summary collapse

Class Method Details

.on_terminal_resize(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/omglog.rb', line 13

def on_terminal_resize &block
  rendering = true
  trap("WINCH") {
    # A dragging resize fires lots of WINCH events; this throttles the redraw
    # and should cause it to (usually) line up with the final dimensions.
    if rendering
      rendering = false
      sleep 0.5
      rendering = true
      yield
    end
  }
end

.run_on(system) ⇒ Object



6
7
8
9
10
# File 'lib/omglog.rb', line 6

def run_on system
  Omglog::Base.run
  on_terminal_resize { Omglog::Base.run }
  system.on_change { Omglog::Base.run }
end