Class: RSpec::Hermetic::ChangeSet
- Inherits:
-
Object
- Object
- RSpec::Hermetic::ChangeSet
- Defined in:
- lib/rspec/hermetic/diff.rb
Instance Attribute Summary collapse
-
#after_errors ⇒ Object
readonly
Returns the value of attribute after_errors.
-
#after_timings ⇒ Object
readonly
Returns the value of attribute after_timings.
-
#before_errors ⇒ Object
readonly
Returns the value of attribute before_errors.
-
#before_timings ⇒ Object
readonly
Returns the value of attribute before_timings.
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #errors? ⇒ Boolean
-
#initialize(changes:, before_errors:, after_errors:, before_timings:, after_timings:) ⇒ ChangeSet
constructor
A new instance of ChangeSet.
- #timings ⇒ Object
Constructor Details
#initialize(changes:, before_errors:, after_errors:, before_timings:, after_timings:) ⇒ ChangeSet
Returns a new instance of ChangeSet.
10 11 12 13 14 15 16 |
# File 'lib/rspec/hermetic/diff.rb', line 10 def initialize(changes:, before_errors:, after_errors:, before_timings:, after_timings:) @changes = changes @before_errors = before_errors @after_errors = after_errors @before_timings = before_timings @after_timings = after_timings end |
Instance Attribute Details
#after_errors ⇒ Object (readonly)
Returns the value of attribute after_errors.
8 9 10 |
# File 'lib/rspec/hermetic/diff.rb', line 8 def after_errors @after_errors end |
#after_timings ⇒ Object (readonly)
Returns the value of attribute after_timings.
8 9 10 |
# File 'lib/rspec/hermetic/diff.rb', line 8 def after_timings @after_timings end |
#before_errors ⇒ Object (readonly)
Returns the value of attribute before_errors.
8 9 10 |
# File 'lib/rspec/hermetic/diff.rb', line 8 def before_errors @before_errors end |
#before_timings ⇒ Object (readonly)
Returns the value of attribute before_timings.
8 9 10 |
# File 'lib/rspec/hermetic/diff.rb', line 8 def before_timings @before_timings end |
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
8 9 10 |
# File 'lib/rspec/hermetic/diff.rb', line 8 def changes @changes end |
Instance Method Details
#empty? ⇒ Boolean
18 19 20 |
# File 'lib/rspec/hermetic/diff.rb', line 18 def empty? changes.empty? end |
#errors? ⇒ Boolean
22 23 24 |
# File 'lib/rspec/hermetic/diff.rb', line 22 def errors? before_errors.any? || after_errors.any? end |
#timings ⇒ Object
26 27 28 29 30 31 |
# File 'lib/rspec/hermetic/diff.rb', line 26 def timings probe_names = before_timings.keys | after_timings.keys probe_names.to_h do |probe| [probe, before_timings.fetch(probe, 0.0) + after_timings.fetch(probe, 0.0)] end end |