Sha256: 7e9505f939395ec4c798910171b28b9087a863316cd7ec9246f2946590445a31
Contents?: true
Size: 588 Bytes
Versions: 3
Compression:
Stored size: 588 Bytes
Contents
# 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 end def order grouped_config.reduce({}) do |result, group| _group_name, group_items = group result.merge!(order_by_key(group_items)) end end private def order_by_key(config_hash) config_hash.sort_by(&:first).to_h end def grouped_config Ruboclean::Grouper.new(@config_hash).group_config end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruboclean-0.2.1 | lib/ruboclean/orderer.rb |
ruboclean-0.2.0 | lib/ruboclean/orderer.rb |
ruboclean-0.1.0 | lib/ruboclean/orderer.rb |