Class: DeprecationToolkit::Collector
- Inherits:
-
Object
- Object
- DeprecationToolkit::Collector
- Extended by:
- ReadWriteHelper
- Includes:
- Comparable
- Defined in:
- lib/deprecation_toolkit/collector.rb
Class Method Summary collapse
Instance Method Summary collapse
- #-(other) ⇒ Object
- #<=>(other) ⇒ Object
- #deprecations_without_stacktrace ⇒ Object
- #flaky? ⇒ Boolean
-
#initialize(deprecations) ⇒ Collector
constructor
A new instance of Collector.
Methods included from ReadWriteHelper
Constructor Details
#initialize(deprecations) ⇒ Collector
Returns a new instance of Collector.
28 29 30 |
# File 'lib/deprecation_toolkit/collector.rb', line 28 def initialize(deprecations) self.deprecations = deprecations end |
Class Method Details
.collect(message) ⇒ Object
15 16 17 |
# File 'lib/deprecation_toolkit/collector.rb', line 15 def collect() deprecations << end |
.load(test) ⇒ Object
19 20 21 |
# File 'lib/deprecation_toolkit/collector.rb', line 19 def load(test) new(read(test)) end |
.reset! ⇒ Object
23 24 25 |
# File 'lib/deprecation_toolkit/collector.rb', line 23 def reset! deprecations.clear end |
Instance Method Details
#-(other) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/deprecation_toolkit/collector.rb', line 44 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) ⇒ Object
32 33 34 |
# File 'lib/deprecation_toolkit/collector.rb', line 32 def <=>(other) deprecations_without_stacktrace <=> other.deprecations_without_stacktrace end |
#deprecations_without_stacktrace ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/deprecation_toolkit/collector.rb', line 36 def deprecations_without_stacktrace deprecations.map do |deprecation| deprecation .sub(*active_support_deprecation_sub_params) .sub(*gem_deprecate_sub_params) end end |
#flaky? ⇒ Boolean
61 62 63 |
# File 'lib/deprecation_toolkit/collector.rb', line 61 def flaky? size == 1 && deprecations.first["flaky"] == true end |