class Ruboclean::Orderer
Orders the items within the groups alphabetically
Public Class Methods
new(config_hash)
click to toggle source
# File lib/ruboclean/orderer.rb, line 8 def initialize(config_hash) @config_hash = config_hash end
Public Instance Methods
order()
click to toggle source
# File lib/ruboclean/orderer.rb, line 12 def order grouped_config.reduce({}) do |result, group| _group_name, group_items = group result.merge!(order_by_key(group_items)) end end
Private Instance Methods
grouped_config()
click to toggle source
# File lib/ruboclean/orderer.rb, line 25 def grouped_config Ruboclean::Grouper.new(@config_hash).group_config end
order_by_key(config_hash)
click to toggle source
# File lib/ruboclean/orderer.rb, line 21 def order_by_key(config_hash) config_hash.sort_by(&:first).to_h end