Class: MotherBrain::Console

Inherits:
Pry::REPL
  • Object
show all
Defined in:
lib/mb/console.rb

Class Method Summary collapse

Class Method Details

.default_prompt(target, nest_level, pry) ⇒ Object



30
31
32
# File 'lib/mb/console.rb', line 30

def default_prompt(target, nest_level, pry)
  "mb(#{Pry.view_clip(target.class)}: #{Pry.view_clip(target)}):[#{nest_level}] >> "
end

.start(options = {}) ⇒ Object

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :target (Object) — default: {MB::Application}

    The initial context for this session.

  • :prompt (Array<Proc>) — default: {Console.default_prompt}

    The array of Procs to use for prompts.

  • :input (#readline)

    The object to use for input.

  • :output (#puts)

    The object to use for output.

  • :commands (Pry::CommandBase)

    The object to use for commands.

  • :hooks (Hash)

    The defined hook Procs.

  • :print (Proc)

    The Proc to use for printing return values.

  • :quiet (Boolean)

    Omit the ‘whereami` banner when starting.

  • :backtrace (Array<String>)

    The backtrace of the session’s ‘binding.pry` line, if applicable.



25
26
27
28
# File 'lib/mb/console.rb', line 25

def start(options = {})
  options = options.reverse_merge(target: MB::Application, prompt: method(:default_prompt))
  super(options)
end