Class: Replay
Overview
The hard part is to not confuse interface with implementation. Tough because this relies almost entirely on the interface. Possibly reopen STDOUT so that it writes to two, instead of just redefining puts/print?
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
- #end! ⇒ Object
-
#initialize(path, session) ⇒ Replay
constructor
A new instance of Replay.
- #start! ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(path, session) ⇒ Replay
11 12 13 14 |
# File 'lib/chitin/tools/replay.rb', line 11 def initialize(path, session) @path = path @session = session end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/chitin/tools/replay.rb', line 8 def path @path end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
9 10 11 |
# File 'lib/chitin/tools/replay.rb', line 9 def session @session end |
Instance Method Details
#end! ⇒ Object
20 21 22 23 24 25 |
# File 'lib/chitin/tools/replay.rb', line 20 def end! multi = session.out session.out = STDOUT stringio = multi.ios[1] @text = stringio.read end |
#start! ⇒ Object
16 17 18 |
# File 'lib/chitin/tools/replay.rb', line 16 def start! session.out = MultiIO.new STDOUT, StringIO.new end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/chitin/tools/replay.rb', line 27 def to_s @text end |