Sha256: d7194cb6603999313f9cc4a2533240f37cf19833a565dae7d823722827d42383

Contents?: true

Size: 1.1 KB

Versions: 203

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'eac_cli/runner_with/subcommands'
require 'eac_ruby_utils/core_ext'

module Avm
  module With
    module ExtraSubcommands
      # @return [Hash<String, EacCli::Runner>]
      def extra_available_subcommands
        extra_available_subcommands_from_runners_module
      end

      # @return [Hash<String, EacCli::Runner>]
      def extra_available_subcommands_from_runners_module
        self.class.ancestors.reverse.inject({}) do |a, e|
          a.merge(RunnersFromModule.new(e).result)
        end
      end

      class RunnersFromModule
        enable_simple_cache
        common_constructor :the_module

        # @return [Hash<String, EacCli::Runner>]
        def result
          return {} if runners_module.blank?

          ::EacCli::RunnerWith::Subcommands.subcommands_from_module(runners_module)
        end

        def runners_module_uncached
          return nil if the_module.module_parent.blank?

          begin
            the_module.module_parent.const_get('Runners')
          rescue ::NameError
            nil
          end
        end
      end
    end
  end
end

Version data entries

203 entries across 203 versions & 2 rubygems

Version Path
eac_tools-0.80.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.81.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.79.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.80.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.78.0 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.77.1 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.77.0 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.76.1 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.76.0 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.75.2 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.75.1 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.75.0 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.74.1 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.74.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.79.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.73.0 sub/avm/lib/avm/with/extra_subcommands.rb
eac_tools-0.72.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.78.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.70.1 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.77.0 lib/avm/with/extra_subcommands.rb