Class: RubocopTodoCorrector::GemVersionDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop_todo_corrector/gem_version_detector.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gemfile_lock_path:, gem_name:) ⇒ GemVersionDetector

Returns a new instance of GemVersionDetector.



19
20
21
22
# File 'lib/rubocop_todo_corrector/gem_version_detector.rb', line 19

def initialize(gemfile_lock_path:, gem_name:)
  @gemfile_lock_path = gemfile_lock_path
  @gem_name = gem_name
end

Class Method Details

.call(gemfile_lock_path:, gem_name:) ⇒ String?

Parameters:

  • gemfile_lock_path (String)
  • name (String)

Returns:

  • (String, nil)


11
12
13
14
15
16
# File 'lib/rubocop_todo_corrector/gem_version_detector.rb', line 11

def call(gemfile_lock_path:, gem_name:)
  new(
    gemfile_lock_path:,
    gem_name:
  ).call
end

Instance Method Details

#callString?

Returns:

  • (String, nil)


25
26
27
# File 'lib/rubocop_todo_corrector/gem_version_detector.rb', line 25

def call
  specification&.version&.to_s
end