Sha256: e1effc4d8c2af4017e225d08b4b92f5f179f683b857026eb11aa7b68177f36f7

Contents?: true

Size: 988 Bytes

Versions: 44

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'ehbrs/executables'
require 'fileutils'
require 'inifile'

module Ehbrs
  module Vg
    module Wii
      module Wit
        module Parsers
          class Info
            SECTION_NAME_PATTERN = /\A#{::Regexp.quote('IMAGE-FORMAT:')}(.+)\z/.freeze

            enable_simple_cache
            common_constructor :output

            private

            def images_uncached
              ini = ::IniFile.new(content: output)
              r = {}
              ini.sections.each do |section_name|
                image_section_name = parse_image_section_name(section_name)
                r[image_section_name] = ini[section_name] if image_section_name.present?
              end
              r
            end

            def parse_image_section_name(section_name)
              SECTION_NAME_PATTERN.match(section_name).if_present { |m| m[1] }
            end
          end
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
ehbrs-tools-0.35.1 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.35.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.34.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.33.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.32.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.31.1 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.31.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.30.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.29.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.28.3 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.28.2 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.28.1 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.28.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.27.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.26.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.25.1 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.25.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.24.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.23.1 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.23.0 lib/ehbrs/vg/wii/wit/parsers/info.rb