Method: CollinsShell::Console.run_pry_command

Defined in:
lib/collins_shell/console.rb

.run_pry_command(command_string, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/collins_shell/console.rb', line 33

def run_pry_command command_string, options = {}
  options = {
    :show_output => true,
    :output => Pry.output,
    :commands => get_pry_commands
  }.merge!(options)
  output = options[:show_output] ? options[:output] : StringIO.new
  pry = Pry.new(
          :output => output, :input => StringIO.new(command_string),
          :commands => options[:commands], :prompt => proc{""}, :hooks => Pry::Hooks.new
  )
  if options[:binding_stack] then
    pry.binding_stack = options[:binding_stack]
  end
  pry.rep(options[:context])
end