Class: RuboCounsel::CopActions::Configure
- Inherits:
-
Object
- Object
- RuboCounsel::CopActions::Configure
- 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
- #call ⇒ Object
-
#initialize(entry, output: $stdout) ⇒ Configure
constructor
A new instance of Configure.
- #label ⇒ Object
- #reprompt? ⇒ Boolean
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
#call ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rubocounsel/cop_actions.rb', line 56 def call config = {} @entry.configurable_attributes.select(&:promptable?).each do |attr| value = attr.prompt(output: @output) config[attr.name] = value unless value.nil? end config end |
#label ⇒ Object
53 |
# File 'lib/rubocounsel/cop_actions.rb', line 53 def label = "Configure" |
#reprompt? ⇒ Boolean
54 |
# File 'lib/rubocounsel/cop_actions.rb', line 54 def reprompt? = false |