Module: Hanami::CLI::Commands::Command::ClassMethods Private

Defined in:
lib/hanami/cli/commands/command.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class level interface

Since:

  • 1.1.0

Instance Method Summary collapse

Instance Method Details

#requirementsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.1.0



64
65
66
# File 'lib/hanami/cli/commands/command.rb', line 64

def requirements
  @_requirements
end

#requires(*names) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Requires an internal Hanami component

Examples:

require "hanami/cli/commands"

module HanamiDatabaseHelpers
  class TruncateTables < Hanami::CLI::Commands::Command
    requires "model.configuration"

    def call(*)
      url = requirements["model.configuration"].url
      # ...
    end
  end
end

Hanami::CLI.register "db truncate", HanamiDatabaseHelpers::TruncateTables

Parameters:

  • names (Array<String>)

    the name of one or more components

Since:

  • 1.1.0



58
59
60
# File 'lib/hanami/cli/commands/command.rb', line 58

def requires(*names)
  requirements.concat(names)
end