Class: Spellr::OutputStubbed
- Defined in:
- lib/spellr/output_stubbed.rb
Instance Method Summary collapse
-
#marshal_dump ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity.
-
#marshal_load(dumped) ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/AbcSize.
- #stderr ⇒ Object
- #stdin ⇒ Object
- #stdout ⇒ Object
Methods inherited from Output
#<<, #counts, #exit_code, #exit_code=, #increment, #print, #puts, #stderr?, #stdout?, #warn
Instance Method Details
#marshal_dump ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/spellr/output_stubbed.rb', line 19 def marshal_dump # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity l_exit_code = @exit_code if defined?(@exit_code) l_counts = @counts if defined?(@counts) l_stdin = @stdin if defined?(@stdin) l_stdout = @stdout if defined?(@stdout) l_stderr = @stderr if defined?(@stderr) { exit_code: l_exit_code, counts: l_counts, stdin: l_stdin&.string, stdin_pos: l_stdin&.pos, stdout: l_stdout&.string, stdout_pos: l_stdout&.pos, stderr: l_stderr&.string, stderr_pos: l_stderr&.pos } end |
#marshal_load(dumped) ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/AbcSize
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/spellr/output_stubbed.rb', line 38 def marshal_load(dumped) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize if dumped[:stdin] @stdin = StringIO.new(dumped[:stdin]) @stdin.pos = dumped[:stdin_pos] end if dumped[:stdout] @stdout = StringIO.new(dumped[:stdout]) @stdout.pos = dumped[:stdout_pos] end if dumped[:stderr] @stderr = StringIO.new(dumped[:stderr]) @stderr.pos = dumped[:stderr_pos] end @exit_code = dumped[:exit_code] if dumped[:exit_code] @counts = dumped[:counts] if dumped[:counts] end |
#stderr ⇒ Object
15 16 17 |
# File 'lib/spellr/output_stubbed.rb', line 15 def stderr @stderr ||= StringIO.new end |
#stdin ⇒ Object
7 8 9 |
# File 'lib/spellr/output_stubbed.rb', line 7 def stdin @stdin ||= StringIO.new end |
#stdout ⇒ Object
11 12 13 |
# File 'lib/spellr/output_stubbed.rb', line 11 def stdout @stdout ||= StringIO.new end |