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
avm-0.94.1 lib/avm/with/extra_subcommands.rb
eac_tools-0.98.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.94.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.94.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.93.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.92.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.92.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.91.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.90.1 lib/avm/with/extra_subcommands.rb
eac_tools-0.87.1 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.90.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.87.0 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.89.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.86.12 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.88.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.86.11 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.87.0 lib/avm/with/extra_subcommands.rb
eac_tools-0.86.8 sub/avm/lib/avm/with/extra_subcommands.rb
avm-0.86.2 lib/avm/with/extra_subcommands.rb
eac_tools-0.86.7 sub/avm/lib/avm/with/extra_subcommands.rb