class DeprecationToolkit::Collector

Public Class Methods

collect(message) click to toggle source
# File lib/deprecation_toolkit/collector.rb, line 15
def collect(message)
  deprecations << message
end
load(test) click to toggle source
# File lib/deprecation_toolkit/collector.rb, line 19
def load(test)
  new(read(test))
end
new(deprecations) click to toggle source
# File lib/deprecation_toolkit/collector.rb, line 28
def initialize(deprecations)
  self.deprecations = deprecations
end
reset!() click to toggle source
# File lib/deprecation_toolkit/collector.rb, line 23
def reset!
  deprecations.clear
end

Public Instance Methods

-(other) click to toggle source
# File lib/deprecation_toolkit/collector.rb, line 46
def -(other)
  difference = deprecations.dup
  current = deprecations_without_stacktrace
  other = other.deprecations_without_stacktrace

  other.each do |deprecation|
    index = current.index(deprecation)

    if index
      current.delete_at(index)
      difference.delete_at(index)
    end
  end

  difference
end
<=>(other) click to toggle source
# File lib/deprecation_toolkit/collector.rb, line 32
def <=>(other)
  deprecations_without_stacktrace <=> other.deprecations_without_stacktrace
end
deprecations_without_stacktrace() click to toggle source
# File lib/deprecation_toolkit/collector.rb, line 36
def deprecations_without_stacktrace
  deprecations.map do |deprecation|
    if ActiveSupport.gem_version.to_s < "5.0"
      deprecation.sub(/\W\s\(called from .*\)$/, "")
    else
      deprecation.sub(/ \(called from .*\)$/, "")
    end
  end
end
flaky?() click to toggle source
# File lib/deprecation_toolkit/collector.rb, line 63
def flaky?
  size == 1 && deprecations.first['flaky'] == true
end