Class: SpinningCursor::Cursor

Inherits:
Object
  • Object
show all
Includes:
ConsoleHelpers
Defined in:
lib/spinning_cursor/cursor.rb

Overview

This class contains the cursor types (and their helper methods)

Constant Summary

Constants included from ConsoleHelpers

SpinningCursor::ConsoleHelpers::CLR, SpinningCursor::ConsoleHelpers::ESC_CURS_INVIS, SpinningCursor::ConsoleHelpers::ESC_CURS_VIS, SpinningCursor::ConsoleHelpers::ESC_R_AND_CLR, SpinningCursor::ConsoleHelpers::ESC_UP_A_LINE

Instance Method Summary collapse

Methods included from ConsoleHelpers

#capture_console, #captured_console_empty?, #console_captured?, #console_columns, #hide_cursor, #release_console, #reset_line, #restore_stdout_sync_status, #save_stdout_sync_status, #show_cursor

Constructor Details

#initialize(parsed) ⇒ Cursor

As of v0.1.0: only initializes the cursor class, use the spin method to start the printing. Takes only the banner argument as a result of this.



13
14
15
# File 'lib/spinning_cursor/cursor.rb', line 13

def initialize(parsed)
  @parsed = parsed
end

Instance Method Details

#spinObject

Takes a cursor type symbol and delay, and starts the printing



20
21
22
23
24
25
26
27
# File 'lib/spinning_cursor/cursor.rb', line 20

def spin
  $stdout.sync = true
  if @parsed.delay
    send @parsed.type, @parsed.delay
  else
    send @parsed.type
  end
end