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.



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

def initialize(file)
  super
  @io = IRB::MagicFile.open(file)
end

Instance Attribute Details

#file_nameObject (readonly)

Returns the value of attribute file_name



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

def file_name
  @file_name
end

Instance Method Details

#encodingObject



92
93
94
# File 'lib/irb/input-method.rb', line 92

def encoding
  @io.external_encoding
end

#eof?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/irb/input-method.rb', line 81

def eof?
  @io.eof?
end

#getsObject



85
86
87
88
89
90
# File 'lib/irb/input-method.rb', line 85

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