Class: R2do::UI

Inherits:
Object
  • Object
show all
Defined in:
lib/r2do/ui.rb

Class Method Summary collapse

Class Method Details

.input(message) ⇒ String

Accepts user input after displaying a message

Returns:

  • (String)

    the value the user inserted



47
48
49
50
51
# File 'lib/r2do/ui.rb', line 47

def self.input(message)
  print "#{message}  "
  $stdout.flush
  value = $stdin.gets.chomp
end

.new_linevoid

This method returns an undefined value.

Adds a new empty line on the display



40
41
42
# File 'lib/r2do/ui.rb', line 40

def self.new_line()
  puts
end

.rescue(exception) ⇒ void

This method returns an undefined value.

Displays a status message to the user

Parameters:

  • message (String)

    the message to display to the user



33
34
35
# File 'lib/r2do/ui.rb', line 33

def self.rescue(exception)
  puts "abort: #{exception.message}"
end

.status(message) ⇒ void

This method returns an undefined value.

Displays a status message to the user

Parameters:

  • message (String)

    the message to display to the user



25
26
27
# File 'lib/r2do/ui.rb', line 25

def self.status(message)
  puts message
end