Sha256: 0981297e38727377433b3725cbb5ad23efaff6324a2d9ea3e00a22f22f50794b

Contents?: true

Size: 857 Bytes

Versions: 3

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_base0/core_ext'

module Ehbrs
  module Tools
    class Runner
      class Music
        class Sort
          class Load
            runner_with :help, :confirmation

            def run
              info "Reading \"#{path}\"..."
              config = build_config
              s = config.to_yaml
              puts s
              if confirm?
                info("Writing to \"#{config_file}\"...")
                File.write(config_file, s)
              end
              puts 'Done!'.green
            end

            private

            def build_config
              config = {}
              scanner.by_section.each do |section, fs|
                config[section] = fs.sort.map(&:name)
              end
              config
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ehbrs-tools-0.43.1 lib/ehbrs/tools/runner/music/sort/load.rb
ehbrs-tools-0.43.0 lib/ehbrs/tools/runner/music/sort/load.rb
ehbrs-tools-0.42.0 lib/ehbrs/tools/runner/music/sort/load.rb