Top Level Namespace

Defined Under Namespace

Modules: File_Checking, Logging, Scrollable, Translating Classes: Action, BusyIndicator, Cell, Column, Menu, Row, ScrollException, SheetData, SheetInterface, TClass, 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"
ODS_MIME =
"application/vnd.oasis.opendocument.spreadsheet"
XLS_MIME =
"application/vnd.ms-excel"
XLSX_MIME =
"application/octet-stream"
CSV_MIME =
"text/plain"
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



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

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

#blue(text) ⇒ Object



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

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

#bold(text) ⇒ Object



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

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



26
27
28
# File 'lib/color_output.rb', line 26

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



18
19
20
# File 'lib/color_output.rb', line 18

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

#cyan(text) ⇒ Object



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

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

#debout(str) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/user_input.rb', line 44

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

#green(text) ⇒ Object



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

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

#purple(text) ⇒ Object



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

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

#red(text) ⇒ Object



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

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

#style(text, style_code) ⇒ Object



22
23
24
# File 'lib/color_output.rb', line 22

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

#underline(text) ⇒ Object



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

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

#wait_for_userObject

unblocking read from STDIN



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/user_input.rb', line 29

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



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

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

#white_on_black(text) ⇒ Object



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

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

#yellow(text) ⇒ Object



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

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