Class: Assert::DefaultView::ResultData

Inherits:
Struct
  • Object
show all
Defined in:
lib/assert/default_view.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for_result(r) ⇒ Object


187
188
189
# File 'lib/assert/default_view.rb', line 187

def self.for_result(r)
  new(r.type, r.to_s, r.output, r.test_id, sort_by(r))
end

.sort_by(r) ⇒ Object


191
192
193
# File 'lib/assert/default_view.rb', line 191

def self.sort_by(r)
  [r.test_file_name, r.test_line_num, r.file_name, r.line_num]
end

Instance Method Details

#<=>(other) ⇒ Object


195
196
197
198
199
200
201
202
# File 'lib/assert/default_view.rb', line 195

def <=>(other)
  # show in reverse definition order
  if other.is_a?(ResultData)
    other.sort_by <=> sort_by
  else
    super
  end
end