Class: Gloo::App::Platform

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo/app/platform.rb

Constant Summary collapse

DEFAULT_TMP_FILE =
'tmp.txt'.freeze
RETURN =
"\n".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlatform

Set up Platform.



22
23
24
25
# File 'lib/gloo/app/platform.rb', line 22

def initialize
  @prompt = Gloo::App::Prompt.new( self )
  @table = Gloo::App::Table.new( self )
end

Instance Attribute Details

#promptObject (readonly)

Returns the value of attribute prompt.



17
18
19
# File 'lib/gloo/app/platform.rb', line 17

def prompt
  @prompt
end

#tableObject (readonly)

Returns the value of attribute table.



17
18
19
# File 'lib/gloo/app/platform.rb', line 17

def table
  @table
end

Instance Method Details

#clear_screenObject

Clear the screen.



37
38
39
# File 'lib/gloo/app/platform.rb', line 37

def clear_screen
  puts "\e[H\e[2J"
end

#colsObject

Get the number of horizontal columns on screen.



76
77
78
79
# File 'lib/gloo/app/platform.rb', line 76

def cols
  rows, columns = $stdout.winsize
  return columns
end

#getColorizedString(str, color) ⇒ Object

Get colorized string.



56
57
58
59
# File 'lib/gloo/app/platform.rb', line 56

def getColorizedString( str, color )
  colorized = ColorizedString[ str.to_s ].colorize( color )
  return colorized.to_s
end

#getFileMech(engine) ⇒ Object

Get the file mechanism for this platform.



44
45
46
# File 'lib/gloo/app/platform.rb', line 44

def getFileMech( engine )
  return Gloo::Persist::DiscMech.new( engine )
end

#linesObject


Sceen helpers

Get the number of vertical lines on screen.



68
69
70
71
# File 'lib/gloo/app/platform.rb', line 68

def lines
  rows, columns = $stdout.winsize
  return rows
end

#show(msg) ⇒ Object

Show a message.



30
31
32
# File 'lib/gloo/app/platform.rb', line 30

def show( msg )
  puts msg
end