Class: Dependabot::Workspace::Base
- Inherits:
-
Object
- Object
- Dependabot::Workspace::Base
- Extended by:
- T::Generic, T::Helpers, T::Sig
- Defined in:
- lib/dependabot/workspace/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#change_attempts ⇒ Object
readonly
Returns the value of attribute change_attempts.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #change(memo = nil, &_blk) ⇒ Object
- #changed? ⇒ Boolean
- #changes ⇒ Object
- #failed_change_attempts ⇒ Object
-
#initialize(path) ⇒ Base
constructor
A new instance of Base.
- #reset! ⇒ Object
- #store_change(memo = nil) ⇒ Object
- #to_patch ⇒ Object
Constructor Details
#initialize(path) ⇒ Base
Returns a new instance of Base.
22 23 24 25 |
# File 'lib/dependabot/workspace/base.rb', line 22 def initialize(path) @path = path @change_attempts = T.let([], T::Array[Dependabot::Workspace::ChangeAttempt]) end |
Instance Attribute Details
#change_attempts ⇒ Object (readonly)
Returns the value of attribute change_attempts.
16 17 18 |
# File 'lib/dependabot/workspace/base.rb', line 16 def change_attempts @change_attempts end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
19 20 21 |
# File 'lib/dependabot/workspace/base.rb', line 19 def path @path end |
Instance Method Details
#change(memo = nil, &_blk) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/dependabot/workspace/base.rb', line 50 def change(memo = nil, &_blk) Dir.chdir(path) { yield(path) } rescue StandardError => e capture_failed_change_attempt(memo, e) clean # clean up any failed changes raise e end |
#changed? ⇒ Boolean
28 29 30 |
# File 'lib/dependabot/workspace/base.rb', line 28 def changed? changes.any? end |
#changes ⇒ Object
33 34 35 |
# File 'lib/dependabot/workspace/base.rb', line 33 def changes change_attempts.select(&:success?) end |
#failed_change_attempts ⇒ Object
38 39 40 |
# File 'lib/dependabot/workspace/base.rb', line 38 def failed_change_attempts change_attempts.select(&:error?) end |
#reset! ⇒ Object
67 |
# File 'lib/dependabot/workspace/base.rb', line 67 def reset!; end |
#store_change(memo = nil) ⇒ Object
61 |
# File 'lib/dependabot/workspace/base.rb', line 61 def store_change(memo = nil); end |
#to_patch ⇒ Object
64 |
# File 'lib/dependabot/workspace/base.rb', line 64 def to_patch; end |