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.22.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.21.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.20.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.19.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.18.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.17.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.16.5 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.16.4 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.16.3 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.16.2 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.16.1 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.16.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.15.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.14.1 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.14.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.13.1 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.13.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.12.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.11.0 lib/ehbrs/vg/wii/wit/parsers/info.rb
ehbrs-tools-0.10.0 lib/ehbrs/vg/wii/wit/parsers/info.rb