Class: Ruboclean::Grouper
- Inherits:
-
Object
- Object
- Ruboclean::Grouper
- Defined in:
- lib/ruboclean/grouper.rb
Overview
Groups the rubocop configuration items into three categories:
- base: base configuration like 'require', 'inherit_from', etc
- namespaces: every item which does **not** include an "/"
- cops: every item which **includes** an "/"
Instance Method Summary collapse
- #group_config ⇒ Object
-
#initialize(configuration_hash) ⇒ Grouper
constructor
A new instance of Grouper.
Constructor Details
#initialize(configuration_hash) ⇒ Grouper
Returns a new instance of Grouper.
9 10 11 |
# File 'lib/ruboclean/grouper.rb', line 9 def initialize(configuration_hash) @configuration_hash = configuration_hash end |
Instance Method Details
#group_config ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/ruboclean/grouper.rb', line 13 def group_config configuration_hash.each_with_object(empty_groups) do |item, result| key, value = item target_group = find_target_group(key) result[target_group].merge!({ key => value }) end end |