Class: Warg::Console::IOProxy
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Warg::Console::IOProxy
- Defined in:
- lib/warg.rb
Instance Method Summary collapse
-
#initialize(io, console) ⇒ IOProxy
constructor
A new instance of IOProxy.
- #print(*texts) ⇒ Object
- #puts(*texts) ⇒ Object
- #write(*texts) ⇒ Object
Constructor Details
Instance Method Details
#print(*texts) ⇒ Object
209 210 211 212 213 214 215 216 217 |
# File 'lib/warg.rb', line 209 def print(*texts) texts.each do |text| @io.print text append_to_console_history text end nil end |
#puts(*texts) ⇒ Object
219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/warg.rb', line 219 def puts(*texts) texts.each do |text| @io.puts text append_to_console_history text unless text.to_s.end_with?("\n") append_to_console_history "\n" end end nil end |
#write(*texts) ⇒ Object
233 234 235 236 237 238 239 240 241 |
# File 'lib/warg.rb', line 233 def write(*texts) texts.inject(0) do |count, text| @io.print text append_to_console_history(text) count + text.to_s.length end end |