Class: RubyLsp::Tapioca::LockfileDiffParser
- Inherits:
-
Object
- Object
- RubyLsp::Tapioca::LockfileDiffParser
- Defined in:
- lib/ruby_lsp/tapioca/lockfile_diff_parser.rb
Constant Summary collapse
- GEM_NAME_PATTERN =
/[\w\-]+/
- DIFF_LINE_PATTERN =
/[+-](.*#{GEM_NAME_PATTERN})\s*\(/
- ADDED_LINE_PATTERN =
/^\+.*#{GEM_NAME_PATTERN} \(.*\)/
- REMOVED_LINE_PATTERN =
/^-.*#{GEM_NAME_PATTERN} \(.*\)/
Instance Attribute Summary collapse
-
#added_or_modified_gems ⇒ Object
readonly
Returns the value of attribute added_or_modified_gems.
-
#removed_gems ⇒ Object
readonly
Returns the value of attribute removed_gems.
Instance Method Summary collapse
-
#initialize(diff_content, direct_dependencies: nil) ⇒ LockfileDiffParser
constructor
A new instance of LockfileDiffParser.
Constructor Details
#initialize(diff_content, direct_dependencies: nil) ⇒ LockfileDiffParser
Returns a new instance of LockfileDiffParser.
17 18 19 20 21 22 23 |
# File 'lib/ruby_lsp/tapioca/lockfile_diff_parser.rb', line 17 def initialize(diff_content, direct_dependencies: nil) @diff_content = diff_content.lines @current_dependencies = direct_dependencies || Bundler::LockfileParser.new(Bundler.default_lockfile.read).dependencies.keys @added_or_modified_gems = parse_added_or_modified_gems @removed_gems = parse_removed_gems end |
Instance Attribute Details
#added_or_modified_gems ⇒ Object (readonly)
Returns the value of attribute added_or_modified_gems.
14 15 16 |
# File 'lib/ruby_lsp/tapioca/lockfile_diff_parser.rb', line 14 def added_or_modified_gems @added_or_modified_gems end |
#removed_gems ⇒ Object (readonly)
Returns the value of attribute removed_gems.
15 16 17 |
# File 'lib/ruby_lsp/tapioca/lockfile_diff_parser.rb', line 15 def removed_gems @removed_gems end |