Class: Assert::Result::Backtrace

Inherits:
Array
  • Object
show all
Defined in:
lib/assert/result.rb

Constant Summary collapse

ASSERT_DIR =

‘./lib’ in project dir, or ‘/usr/local/blahblah’ if installed

File.dirname(File.dirname(file))

Instance Method Summary collapse

Constructor Details

#initialize(value = nil) ⇒ Backtrace

Returns a new instance of Backtrace.



42
43
44
# File 'lib/assert/result.rb', line 42

def initialize(value=nil)
  super(value || ["No backtrace"])
end

Instance Method Details

#filteredObject



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/assert/result.rb', line 50

def filtered
  new_bt = []

  self.each do |line|
    break if filter_out?(line)
    new_bt << line
  end

  new_bt = self.reject { |line| filter_out?(line) } if new_bt.empty?
  new_bt = self.dup if new_bt.empty?

  self.class.new(new_bt)
end

#to_sObject



46
47
48
# File 'lib/assert/result.rb', line 46

def to_s
  self.join("\n")
end