Class: Linters::Linter

Inherits:
Object
  • Object
show all
Defined in:
lib/linters/linter.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, custom_settings = {}) ⇒ Linter

Returns a new instance of Linter.



3
4
5
# File 'lib/linters/linter.rb', line 3

def initialize(name, custom_settings = {})
  @settings = LinterSettings.new(name, custom_settings)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/linters/linter.rb', line 13

def method_missing(method, *args, &block)
  if %i[warnings_number name].include?(method)
    settings.send(method)
  else
    super
  end
end

Instance Method Details

#performObject



7
8
9
10
11
# File 'lib/linters/linter.rb', line 7

def perform
  command_output = `#{ settings.command }`

  settings.parse_output.call(command_output)
end

#respond_to_missing?(method, include_private = false) ⇒ Boolean

:reek:BooleanParameter

Returns:

  • (Boolean)


22
23
24
# File 'lib/linters/linter.rb', line 22

def respond_to_missing?(method, include_private = false)
  %i[warnings_number name].include?(method) || super
end