Class: SeeingIsBelieving::Result
- Inherits:
-
Object
- Object
- SeeingIsBelieving::Result
- Includes:
- HasException, TracksLineNumbersSeen
- Defined in:
- lib/seeing_is_believing/result.rb
Defined Under Namespace
Classes: Line
Constant Summary
Constants included from TracksLineNumbersSeen
TracksLineNumbersSeen::INITIAL_LINE_NUMBER
Instance Attribute Summary collapse
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#stdout ⇒ Object
Returns the value of attribute stdout.
Attributes included from HasException
Instance Method Summary collapse
- #[](line_number) ⇒ Object
- #has_stderr? ⇒ Boolean
- #has_stdout? ⇒ Boolean
-
#initialize ⇒ Result
constructor
A new instance of Result.
- #record_exception(line_number, exception) ⇒ Object
- #record_result(line_number, value) ⇒ Object
-
#to_a ⇒ Object
probably not really useful, just exists to satisfy the tests, which specified too simple of an interface.
Methods included from TracksLineNumbersSeen
#max_line_number, #min_line_number, #track_line_number
Constructor Details
#initialize ⇒ Result
Returns a new instance of Result.
41 42 43 |
# File 'lib/seeing_is_believing/result.rb', line 41 def initialize @min_line_number = @max_line_number = 1 end |
Instance Attribute Details
#stderr ⇒ Object
Returns the value of attribute stderr.
31 32 33 |
# File 'lib/seeing_is_believing/result.rb', line 31 def stderr @stderr end |
#stdout ⇒ Object
Returns the value of attribute stdout.
31 32 33 |
# File 'lib/seeing_is_believing/result.rb', line 31 def stdout @stdout end |
Instance Method Details
#[](line_number) ⇒ Object
57 58 59 |
# File 'lib/seeing_is_believing/result.rb', line 57 def [](line_number) results(line_number) end |
#has_stderr? ⇒ Boolean
37 38 39 |
# File 'lib/seeing_is_believing/result.rb', line 37 def has_stderr? stderr && !stderr.empty? end |
#has_stdout? ⇒ Boolean
33 34 35 |
# File 'lib/seeing_is_believing/result.rb', line 33 def has_stdout? stdout && !stdout.empty? end |
#record_exception(line_number, exception) ⇒ Object
51 52 53 54 55 |
# File 'lib/seeing_is_believing/result.rb', line 51 def record_exception(line_number, exception) self.exception = exception track_line_number line_number results(line_number).exception = exception end |
#record_result(line_number, value) ⇒ Object
45 46 47 48 49 |
# File 'lib/seeing_is_believing/result.rb', line 45 def record_result(line_number, value) track_line_number line_number results(line_number) << value.inspect value end |
#to_a ⇒ Object
probably not really useful, just exists to satisfy the tests, which specified too simple of an interface
62 63 64 65 66 |
# File 'lib/seeing_is_believing/result.rb', line 62 def to_a (min_line_number..max_line_number).map do |line_number| [line_number, [*self[line_number].to_ary, *Array(self[line_number].exception)]] end end |