Class: RSpec::Hermetic::Change
- Inherits:
-
Struct
- Object
- Struct
- RSpec::Hermetic::Change
- Defined in:
- lib/rspec/hermetic/change.rb
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#before ⇒ Object
Returns the value of attribute before.
-
#key ⇒ Object
Returns the value of attribute key.
-
#probe ⇒ Object
Returns the value of attribute probe.
Instance Method Summary collapse
- #addition? ⇒ Boolean
- #append_only? ⇒ Boolean
- #mutation? ⇒ Boolean
- #removal? ⇒ Boolean
- #token_candidates ⇒ Object
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after
7 8 9 |
# File 'lib/rspec/hermetic/change.rb', line 7 def after @after end |
#before ⇒ Object
Returns the value of attribute before
7 8 9 |
# File 'lib/rspec/hermetic/change.rb', line 7 def before @before end |
#key ⇒ Object
Returns the value of attribute key
7 8 9 |
# File 'lib/rspec/hermetic/change.rb', line 7 def key @key end |
#probe ⇒ Object
Returns the value of attribute probe
7 8 9 |
# File 'lib/rspec/hermetic/change.rb', line 7 def probe @probe end |
Instance Method Details
#addition? ⇒ Boolean
8 9 10 |
# File 'lib/rspec/hermetic/change.rb', line 8 def addition? before.equal?(self.class::MISSING) && !after.equal?(self.class::MISSING) end |
#append_only? ⇒ Boolean
28 29 30 31 32 33 |
# File 'lib/rspec/hermetic/change.rb', line 28 def append_only? return true if addition? return false if removal? append_only_value?(before, after) end |
#mutation? ⇒ Boolean
16 17 18 |
# File 'lib/rspec/hermetic/change.rb', line 16 def mutation? !addition? && !removal? end |
#removal? ⇒ Boolean
12 13 14 |
# File 'lib/rspec/hermetic/change.rb', line 12 def removal? after.equal?(self.class::MISSING) && !before.equal?(self.class::MISSING) end |
#token_candidates ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/rspec/hermetic/change.rb', line 20 def token_candidates [ probe.to_sym, key.to_s.tr(".[]\"$/:-", "_").gsub(/__+/, "_").downcase.to_sym, "#{probe}:#{key}".to_sym ] end |