Class: FXIRBInputMethod

Inherits:
IRB::StdioInputMethod
  • Object
show all
Defined in:
lib/fxirb.rb

Instance Method Summary collapse

Constructor Details

#initializeFXIRBInputMethod

Returns a new instance of FXIRBInputMethod.



25
26
27
28
29
30
# File 'lib/fxirb.rb', line 25

def initialize
	super 
	@history = 1
	@begin = nil
	@end = nil
end

Instance Method Details

#compactObject



49
50
51
52
53
54
55
56
# File 'lib/fxirb.rb', line 49

def compact
	print [@compact, @continued].inspect
	if false # @compact
		@compact = false
		a = @line_no - @continued
		@lines[a] = @lines[a..2].join
	end
end

#getsObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fxirb.rb', line 32

def gets 
	print @prompt
	
	if @prompt =~ /(\d+)[>*]/
		print "  "*$1.to_i
	end
	
	str = FXIrb.instance.gets
	if /^exit/ =~ str
		exit
	end
	
	@line_no += 1
	@history = @line_no + 1
	@line[@line_no] = str
end

#nextCmdObject



66
67
68
69
70
71
72
# File 'lib/fxirb.rb', line 66

def nextCmd
	if (@line_no > 0) && (@history < @line_no)
		@history += 1
		return line(@history)
	end
	return ""
end

#prevCmdObject



58
59
60
61
62
63
64
# File 'lib/fxirb.rb', line 58

def prevCmd
	if @line_no > 0
		@history -= 1 unless @history <= 1
		return line(@history)
	end
	return ""
end