Sha256: 7f7c2fd8c15d4880c181aa4fef77476ec405476051a22fa4017b9da18a418c95

Contents?: true

Size: 703 Bytes

Versions: 8

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module EacCli
  class Parser
    require_sub __FILE__
    enable_simple_cache
    common_constructor :definition, :argv

    private

    def parsed_uncached
      raise 'Definition has no alternatives' if alternatives.empty?

      alternatives.each do |alt_parser|
        return alt_parser.parsed unless alt_parser.error?
      end

      raise first_error
    end

    def alternatives_uncached
      definition.alternatives
                .map { |alternative| ::EacCli::Parser::Alternative.new(alternative, argv) }
    end

    def first_error_uncached
      alternatives.lazy.select(&:error?).map(&:error).first
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
avm-tools-0.80.0 vendor/eac_cli/lib/eac_cli/parser.rb
avm-tools-0.79.0 vendor/eac_cli/lib/eac_cli/parser.rb
avm-tools-0.78.0 vendor/eac_cli/lib/eac_cli/parser.rb
ehbrs-tools-0.16.2 vendor/eac_cli/lib/eac_cli/parser.rb
eac_cli-0.12.2 lib/eac_cli/parser.rb
eac_cli-0.12.1 lib/eac_cli/parser.rb
avm-tools-0.77.0 vendor/eac_cli/lib/eac_cli/parser.rb
eac_cli-0.12.0 lib/eac_cli/parser.rb