Class: RuboCounsel::CopActions::Configure

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocounsel/cop_actions.rb

Overview

Walks through each promptable attribute and collects configuration.

Constant Summary collapse

FILE_TARGETING_ATTRIBUTES =
["Include", "Exclude"].freeze

Instance Method Summary collapse

Constructor Details

#initialize(entry, output: $stdout) ⇒ Configure

Returns a new instance of Configure.



48
49
50
51
# File 'lib/rubocounsel/cop_actions.rb', line 48

def initialize(entry, output: $stdout)
  @entry = entry
  @output = output
end

Instance Method Details

#callObject



56
57
58
59
60
61
62
63
64
65
# File 'lib/rubocounsel/cop_actions.rb', line 56

def call
  display_array_attributes_message

  config = {}
  @entry.configurable_attributes.select(&:promptable?).each do |attr|
    value = attr.prompt(output: @output)
    config[attr.name] = value unless value.nil?
  end
  config
end

#labelObject



53
# File 'lib/rubocounsel/cop_actions.rb', line 53

def label = "Configure"

#reprompt?Boolean

Returns:

  • (Boolean)


54
# File 'lib/rubocounsel/cop_actions.rb', line 54

def reprompt? = false