Class: IRB::FileInputMethod

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

Instance Attribute Summary collapse

Attributes inherited from InputMethod

#prompt

Instance Method Summary collapse

Methods inherited from InputMethod

#readable_atfer_eof?

Constructor Details

#initialize(file) ⇒ FileInputMethod

Returns a new instance of FileInputMethod.



66
67
68
69
# File 'lib/irb/input-method.rb', line 66

def initialize(file)
  super
  @io = open(file)
end

Instance Attribute Details

#file_nameObject (readonly)

Returns the value of attribute file_name



70
71
72
# File 'lib/irb/input-method.rb', line 70

def file_name
  @file_name
end

Instance Method Details

#eof?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/irb/input-method.rb', line 72

def eof?
  @io.eof?
end

#getsObject



76
77
78
79
80
81
# File 'lib/irb/input-method.rb', line 76

def gets
  print @prompt
  l = @io.gets
#      print @prompt, l
  l
end