Module: Readline

Defined in:
lib/rbf.rb

Constant Summary collapse

Commands =
['!exit', '!quit', '!storage', '!position', '!get', '!set', '!clear', '!reset']

Class Method Summary collapse

Class Method Details

.readline_with_hist_managementObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rbf.rb', line 39

def self.readline_with_hist_management
  begin
    line = Readline.readline('>> '.bold, true)
  rescue Exception => e
    return
  end

  return unless line

  if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line
    Readline::HISTORY.pop
  end

  line
end

.supported?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
# File 'lib/rbf.rb', line 22

def self.supported?
  require 'colorb'
  require 'readline'

  true
rescue Exception => e
  false
end