Class: SeeingIsBelieving::Line
- Inherits:
-
Object
- Object
- SeeingIsBelieving::Line
- Includes:
- Enumerable, HasException
- Defined in:
- lib/seeing_is_believing/line.rb
Overview
thin wrapper over an array, used by the result
Instance Attribute Summary
Attributes included from HasException
Class Method Summary collapse
Instance Method Summary collapse
- #==(ary_or_line) ⇒ Object
-
#initialize(array = []) ⇒ Line
constructor
A new instance of Line.
- #inspect ⇒ Object
- #to_a ⇒ Object (also: #to_ary)
Constructor Details
#initialize(array = []) ⇒ Line
Returns a new instance of Line.
25 26 27 |
# File 'lib/seeing_is_believing/line.rb', line 25 def initialize(array = []) @array = array.dup end |
Class Method Details
.[](*elements) ⇒ Object
5 6 7 |
# File 'lib/seeing_is_believing/line.rb', line 5 def self.[](*elements) new(elements) end |
Instance Method Details
#==(ary_or_line) ⇒ Object
29 30 31 32 |
# File 'lib/seeing_is_believing/line.rb', line 29 def ==(ary_or_line) return @array == ary_or_line if Array === ary_or_line ary_or_line == @array && exception == ary_or_line.exception end |
#inspect ⇒ Object
34 35 36 37 |
# File 'lib/seeing_is_believing/line.rb', line 34 def inspect inspected_exception = has_exception? ? "#{exception.class}:#{exception..inspect}" : "no exception" "#<SIB:Line#{@array.inspect} #{inspected_exception}>" end |
#to_a ⇒ Object Also known as: to_ary
20 21 22 |
# File 'lib/seeing_is_believing/line.rb', line 20 def to_a @array.dup end |