Class: IRB::StdioInputMethod

Inherits:
InputMethod show all
Defined in:
lib/irb/input-method.rb

Instance Attribute Summary

Attributes inherited from InputMethod

#file_name, #prompt

Instance Method Summary collapse

Constructor Details

#initializeStdioInputMethod

Returns a new instance of StdioInputMethod.



41
42
43
44
45
# File 'lib/irb/input-method.rb', line 41

def initialize
  super
  @line_no = 0
  @line = []
end

Instance Method Details

#eof?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/irb/input-method.rb', line 52

def eof?
  $stdin.eof?
end

#getsObject



47
48
49
50
# File 'lib/irb/input-method.rb', line 47

def gets
  print @prompt
  @line[@line_no += 1] = $stdin.gets
end

#line(line_no) ⇒ Object



60
61
62
# File 'lib/irb/input-method.rb', line 60

def line(line_no)
  @line[line_no]
end

#readable_atfer_eof?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/irb/input-method.rb', line 56

def readable_atfer_eof?
  true
end