Class: RuboCop::CLI::Command::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/cli/command/base.rb

Overview

A subcommand in the CLI.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Base

Returns a new instance of Base.



24
25
26
27
28
29
# File 'lib/rubocop/cli/command/base.rb', line 24

def initialize(env)
  @env = env
  @options = env.options
  @config_store = env.config_store
  @paths = env.paths
end

Class Attribute Details

.command_nameObject

Returns the value of attribute command_name.



13
14
15
# File 'lib/rubocop/cli/command/base.rb', line 13

def command_name
  @command_name
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



8
9
10
# File 'lib/rubocop/cli/command/base.rb', line 8

def env
  @env
end

Class Method Details

.by_command_name(name) ⇒ Object



19
20
21
# File 'lib/rubocop/cli/command/base.rb', line 19

def by_command_name(name)
  @subclasses.detect { |s| s.command_name == name }
end

.inherited(subclass) ⇒ Object



15
16
17
# File 'lib/rubocop/cli/command/base.rb', line 15

def inherited(subclass)
  @subclasses << subclass
end