Class: Hanami::Config::Console

Inherits:
Object
  • Object
show all
Includes:
Dry::Configurable
Defined in:
lib/hanami/config/console.rb

Overview

Hanami console config

Since:

  • 2.3.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConsole

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.

Returns a new instance of Console.

Since:

  • 2.3.0



54
55
56
# File 'lib/hanami/config/console.rb', line 54

def initialize
  @extensions = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)

Since:

  • 2.3.0



66
67
68
69
70
71
72
# File 'lib/hanami/config/console.rb', line 66

def method_missing(name, *args, &block)
  if config.respond_to?(name)
    config.public_send(name, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#engineSymbol

Sets or returns the interactive console engine to be used by ‘hanami console`. Supported values are `:irb` (default) and `:pry`.

Examples:

config.console.engine = :pry

Returns:

  • (Symbol)

Since:

  • 2.3.0



25
# File 'lib/hanami/config/console.rb', line 25

setting :engine, default: :irb

Instance Method Details

#extensionsArray<Module>

Returns the complete list of extensions to be used in the console

Examples:

config.console.include MyExtension, OtherExtension
config.console.include ThirdExtension

config.console.extensions
# => [MyExtension, OtherExtension, ThirdExtension]

Returns:

  • (Array<Module>)

Since:

  • 2.3.0



40
# File 'lib/hanami/config/console.rb', line 40

def extensions = @extensions.dup.freeze

#include(*mod) ⇒ void

This method returns an undefined value.

Define a module extension to be included in the console

Parameters:

  • mod (Module)

    one or more modules to be included in the console

Since:

  • 2.3.0



49
50
51
# File 'lib/hanami/config/console.rb', line 49

def include(*mod)
  @extensions.concat(mod).uniq!
end