Sha256: 2a4ae281c919e7da0ba6504ec9d3dd1e23e15a288ae0b36f2a70e9231b329592

Contents?: true

Size: 557 Bytes

Versions: 11

Compression:

Stored size: 557 Bytes

Contents

module RubyText
  def self.ticker(row: STDSCR.rows-1, col: 0, width: STDSCR.cols, 
                  fg: White, bg: Blue, text:, delay: 0.1)
    text = text.gsub("\n", " ") + " "
    win = RubyText.window(1, width, r: row, c: col, border: false, fg: fg, bg: bg)
    leader = " "*width + text
    leader = text.chars.cycle.each_cons(width)
    width.times { win.rcprint 0, 0, leader.next.join }
    repeat = text.chars.cycle.each_cons(width)
    loop do   # Warning: loops forever
      win.rcprint 0, 0, repeat.next.join
      sleep delay
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rubytext-0.0.95 lib/widgets.rb
rubytext-0.0.94 lib/widgets.rb
rubytext-0.0.93 lib/widgets.rb
rubytext-0.0.92 lib/widgets.rb
rubytext-0.0.91 lib/widgets.rb
rubytext-0.0.90 lib/widgets.rb
rubytext-0.0.89 lib/widgets.rb
rubytext-0.0.88 lib/widgets.rb
rubytext-0.0.87 lib/widgets.rb
rubytext-0.0.86 lib/widgets.rb
rubytext-0.0.85 lib/widgets.rb