Class: XMP::StringInputMethod
- Inherits:
-
IRB::InputMethod
- Object
- IRB::InputMethod
- XMP::StringInputMethod
- Defined in:
- lib/irb/xmp.rb
Instance Attribute Summary
Attributes inherited from IRB::InputMethod
Instance Method Summary collapse
- #eof? ⇒ Boolean
- #gets ⇒ Object
-
#initialize ⇒ StringInputMethod
constructor
A new instance of StringInputMethod.
- #puts(exps) ⇒ Object
Methods inherited from IRB::InputMethod
Constructor Details
#initialize ⇒ StringInputMethod
Returns a new instance of StringInputMethod.
56 57 58 59 |
# File 'lib/irb/xmp.rb', line 56 def initialize super @exps = [] end |
Instance Method Details
#eof? ⇒ Boolean
61 62 63 |
# File 'lib/irb/xmp.rb', line 61 def eof? @exps.empty? end |
#gets ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/irb/xmp.rb', line 65 def gets while l = @exps.shift next if /^\s+$/ =~ l l.concat "\n" print @prompt, l break end l end |
#puts(exps) ⇒ Object
75 76 77 |
# File 'lib/irb/xmp.rb', line 75 def puts(exps) @exps.concat exps.split(/\n/) end |