Class: IRB::StdioInputMethod
- Inherits:
-
InputMethod
- Object
- InputMethod
- IRB::StdioInputMethod
- Defined in:
- lib/virb/default.rb
Instance Method Summary collapse
- #encoding ⇒ Object
- #eof? ⇒ Boolean
- #gets ⇒ Object
-
#initialize ⇒ StdioInputMethod
constructor
A new instance of StdioInputMethod.
- #line(line_no) ⇒ Object
- #readable_atfer_eof? ⇒ Boolean
Constructor Details
#initialize ⇒ StdioInputMethod
Returns a new instance of StdioInputMethod.
33 34 35 36 37 38 39 |
# File 'lib/virb/default.rb', line 33 def initialize super @line_no = 0 @line = [] @stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") @stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") end |
Instance Method Details
#encoding ⇒ Object
60 61 62 |
# File 'lib/virb/default.rb', line 60 def encoding @stdin.external_encoding end |
#eof? ⇒ Boolean
48 49 50 |
# File 'lib/virb/default.rb', line 48 def eof? @stdin.eof? end |
#gets ⇒ Object
41 42 43 44 45 46 |
# File 'lib/virb/default.rb', line 41 def gets print @prompt line = @stdin.gets print line # this is added by dan choi to ensure echoing of executed code in session window @line[@line_no += 1] = line end |
#line(line_no) ⇒ Object
56 57 58 |
# File 'lib/virb/default.rb', line 56 def line(line_no) @line[line_no] end |
#readable_atfer_eof? ⇒ Boolean
52 53 54 |
# File 'lib/virb/default.rb', line 52 def readable_atfer_eof? true end |