Class: RubocopTodoCorrector::CopUrlFinder
- Inherits:
-
Object
- Object
- RubocopTodoCorrector::CopUrlFinder
- Defined in:
- lib/rubocop_todo_corrector/cop_url_finder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ String
-
#initialize(cop_name:, cop_source_path:, temporary_gemfile_path:) ⇒ CopUrlFinder
constructor
A new instance of CopUrlFinder.
Constructor Details
#initialize(cop_name:, cop_source_path:, temporary_gemfile_path:) ⇒ CopUrlFinder
Returns a new instance of CopUrlFinder.
25 26 27 28 29 30 31 32 33 |
# File 'lib/rubocop_todo_corrector/cop_url_finder.rb', line 25 def initialize( cop_name:, cop_source_path:, temporary_gemfile_path: ) @cop_name = cop_name @cop_source_path = cop_source_path @temporary_gemfile_path = temporary_gemfile_path end |
Class Method Details
.call(cop_name:, cop_source_path:, temporary_gemfile_path:) ⇒ String
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rubocop_todo_corrector/cop_url_finder.rb', line 12 def call( cop_name:, cop_source_path:, temporary_gemfile_path: ) new( cop_name:, cop_source_path:, temporary_gemfile_path: ).call end |
Instance Method Details
#call ⇒ String
36 37 38 39 40 41 42 43 44 |
# File 'lib/rubocop_todo_corrector/cop_url_finder.rb', line 36 def call if !captured_url.empty? captured_url elsif gem_name "https://www.rubydoc.info/gems/#{gem_name}/RuboCop/Cop/#{@cop_name}" else "https://www.google.com/search?q=rubocop+#{::URI.encode_www_form_component(@cop_name.inspect)}" end end |