Top Level Namespace

Defined Under Namespace

Modules: BasicLogging, File_Checking, Scrollable, Translating Classes: Action, BusyIndicator, Cell, Column, Menu, Row, ScrollException, SheetData, SheetInterface, ViewWorkBook

Constant Summary collapse

ODS_Magic =

Transforms a file into a Roo spreadsheet instance.

"OpenDocument Spreadsheet"
XLS_Magic =
"Composite Document File V2 Document"
XLSX_Magic =
"Microsoft OOXML"
PMDX_Magic =

SoftMaker Office

"Microsoft Excel 2007+"
ODS_MIME =
"application/vnd.oasis.opendocument.spreadsheet"
XLS_MIME =
"application/vnd.ms-excel"
XLSX_MIME =
"application/zip"
CSV_MIME =
"text/plain"
PMDX_MIME =

SoftMaker Office

"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
COLORS =

functions to apply colors to terminal output

{:default => 9, :black => 0, :red => 1, :green => 2, :yellow => 3, :blue => 4, :purple => 5, :cyan => 6, :white => 7 }
BG =
4
FG =
3
REGULAR =
0
BOLD =
1
UNDERLINE =
4
5
SWAP =
7
NEUTRAL =
0
STYLES =
{:regular => REGULAR, :bold => BOLD, :underline => UNDERLINE, :blink => BLINK, :swap => SWAP, :neutral => NEUTRAL}

Instance Method Summary collapse

Instance Method Details

#black_on_white(text) ⇒ Object



54
# File 'lib/color_output.rb', line 54

def black_on_white(text); colorize(colorize(text, "\033[30m"), "\033[47m");end

#blue(text) ⇒ Object



51
# File 'lib/color_output.rb', line 51

def blue(text); colorize(text, "\033[34m"); end

#bold(text) ⇒ Object



57
# File 'lib/color_output.rb', line 57

def bold(text); style(text, "\033[01m");end

#busy_indicator(width) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/busy_indicator/busy_function_test.rb', line 35

def busy_indicator(width)
  tobj = Thread.new() do
    loop do 
      %w"OOO ooo ___ ooo".each do |s|
        print "%+#{width}s" %s
        sleep 0.1
        print ("\b" * width)
      end
    end
  end
end

#clean_busy_indicator(thr, width, comment) ⇒ Object



28
29
30
31
32
33
# File 'lib/busy_indicator/busy_function_test.rb', line 28

def clean_busy_indicator(thr, width, comment)
  thr.terminate
  thr.join
  print ("\b" * width)
  print ("%+#{width}s\n" %comment)
end

#colored_output(output_text, fg_color = :default, bg_color = :default, style = :regular, mode = :neutral) ⇒ Object



42
43
44
# File 'lib/color_output.rb', line 42

def colored_output(output_text, fg_color = :default, bg_color = :default, style = :regular , mode = :neutral )
  "\033[%i;%i;%i%i;%i%im%s\033[0m" %[STYLES[mode.to_sym], STYLES[style.to_sym], FG, COLORS[fg_color.to_sym], BG, COLORS[bg_color.to_sym], output_text]
end

#colorize(text, color_code) ⇒ Object



34
35
36
# File 'lib/color_output.rb', line 34

def colorize(text, color_code)
    "#{color_code}#{text}\033[0m"
end

#cyan(text) ⇒ Object



50
# File 'lib/color_output.rb', line 50

def cyan(text); colorize(text, "\033[36m"); end

#debout(str) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/user_input.rb', line 37

def debout(str)
  if $DEBUG == :DEBUG
    puts str
    if(wait_for_user().chr == 'q')
      exit true
    end
  end
end

#green(text) ⇒ Object



47
# File 'lib/color_output.rb', line 47

def green(text); colorize(text, "\033[32m"); end

#purple(text) ⇒ Object



49
# File 'lib/color_output.rb', line 49

def purple(text); colorize(text, "\033[35m"); end

#red(text) ⇒ Object



46
# File 'lib/color_output.rb', line 46

def red(text); colorize(text, "\033[31m"); end

#style(text, style_code) ⇒ Object



38
39
40
# File 'lib/color_output.rb', line 38

def style(text, style_code)
  "#{style_code}#{text}\033[0m"
end

#underline(text) ⇒ Object



58
# File 'lib/color_output.rb', line 58

def underline(text); style(text, "\033[04m");end

#wait_for_userObject

unblocking read from STDIN



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/user_input.rb', line 22

def wait_for_user()
    char = nil
  # char = STDIN.raw(&:getc)  
        STDIN.raw do 
                STDIN.noecho do
                        until (STDIN.ready?)
                                sleep(0.1)
                        end

                        char = (STDIN.read_nonblock(1).ord rescue nil)
                end
        end
  return char
end

#white(text) ⇒ Object



52
# File 'lib/color_output.rb', line 52

def white(text); colorize(text, "\033[37m"); end

#white_on_black(text) ⇒ Object



55
# File 'lib/color_output.rb', line 55

def white_on_black(text); colorize(colorize(text, "\033[37m"), "\033[40m");end

#yellow(text) ⇒ Object



48
# File 'lib/color_output.rb', line 48

def yellow(text); colorize(text, "\033[33m"); end