lib/ruboclean/orderer.rb in ruboclean-0.4.0 vs lib/ruboclean/orderer.rb in ruboclean-0.5.0
- old
+ new
@@ -1,14 +1,12 @@
# frozen_string_literal: true
-require "ruboclean/grouper"
-
module Ruboclean
# Orders the items within the groups alphabetically
class Orderer
- def initialize(config_hash)
- @config_hash = config_hash
+ def initialize(configuration_hash)
+ @configuration_hash = configuration_hash
end
def order
grouped_config.reduce({}) do |result, group|
_group_name, group_items = group
@@ -16,14 +14,16 @@
end
end
private
- def order_by_key(config_hash)
- config_hash.sort_by(&:first).to_h
+ attr_reader :configuration_hash
+
+ def order_by_key(group_items)
+ group_items.sort_by(&:first).to_h
end
def grouped_config
- Ruboclean::Grouper.new(@config_hash).group_config
+ Ruboclean::Grouper.new(configuration_hash).group_config
end
end
end