Class: IRB::FileInputMethod
- Inherits:
-
InputMethod
- Object
- InputMethod
- IRB::FileInputMethod
- Defined in:
- lib/irb/input-method.rb
Overview
Use a File for IO with irb, see InputMethod
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
The file name of this input method, usually given during initialization.
Attributes inherited from InputMethod
Instance Method Summary collapse
-
#encoding ⇒ Object
The external encoding for standard input.
-
#eof? ⇒ Boolean
Whether the end of this input method has been reached, returns
true
if there is no more data to read. -
#gets ⇒ Object
Reads the next line from this input method.
-
#initialize(file) ⇒ FileInputMethod
constructor
Creates a new input method object.
Methods inherited from InputMethod
Constructor Details
#initialize(file) ⇒ FileInputMethod
Creates a new input method object
99 100 101 102 |
# File 'lib/irb/input-method.rb', line 99 def initialize(file) super @io = IRB::MagicFile.open(file) end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
The file name of this input method, usually given during initialization.
104 105 106 |
# File 'lib/irb/input-method.rb', line 104 def file_name @file_name end |
Instance Method Details
#encoding ⇒ Object
The external encoding for standard input.
124 125 126 |
# File 'lib/irb/input-method.rb', line 124 def encoding @io.external_encoding end |
#eof? ⇒ Boolean
Whether the end of this input method has been reached, returns true
if there is no more data to read.
See IO#eof? for more information.
110 111 112 |
# File 'lib/irb/input-method.rb', line 110 def eof? @io.eof? end |
#gets ⇒ Object
Reads the next line from this input method.
See IO#gets for more information.
117 118 119 120 121 |
# File 'lib/irb/input-method.rb', line 117 def gets print @prompt l = @io.gets l end |