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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlatform

Set up Platform.



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

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.



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

def prompt
  @prompt
end

#tableObject (readonly)

Returns the value of attribute table.



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

def table
  @table
end

Instance Method Details

#clear_screenObject

Clear the screen.



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

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

#colsObject

Get the number of horizontal columns on screen.



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

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

#getColorizedString(str, color) ⇒ Object

Get colorized string.



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

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.



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

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

#linesObject


Sceen helpers

Get the number of vertical lines on screen.



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

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

#show(msg) ⇒ Object

Show a message.



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

def show( msg )
  puts msg
end