Class: Rucoa::Rubocop::Autocorrector
- Inherits:
-
RuboCop::Runner
- Object
- RuboCop::Runner
- Rucoa::Rubocop::Autocorrector
- Defined in:
- lib/rucoa/rubocop/autocorrector.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ String
-
#initialize(source:) ⇒ Autocorrector
constructor
A new instance of Autocorrector.
Constructor Details
#initialize(source:) ⇒ Autocorrector
Returns a new instance of Autocorrector.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rucoa/rubocop/autocorrector.rb', line 17 def initialize(source:) @source = source super( ::RuboCop::Options.new.parse( %w[ --stderr --force-exclusion --format RuboCop::Formatter::BaseFormatter -A ] ).first, ::RuboCop::ConfigStore.new ) end |
Class Method Details
.call(source:) ⇒ String
11 12 13 |
# File 'lib/rucoa/rubocop/autocorrector.rb', line 11 def call(source:) new(source: source).call end |
Instance Method Details
#call ⇒ String
33 34 35 36 37 |
# File 'lib/rucoa/rubocop/autocorrector.rb', line 33 def call @options[:stdin] = @source.content run([path]) @options[:stdin] end |