Sha256: a4e6db60dd969f305c7e91b1acc2c4daccac1b445cb7a016e8b1470be1ccbbec

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

require 'pry'

class Pry
  # To make the console more useful, we make it so we flush the event registry
  # after each line.  This makes it so events are triggered after each line.
  # To accomplish this we monkey-patch pry.
  def rep(target=TOPLEVEL_BINDING)
    target = Pry.binding_for(target)
    result = re(target)

    Pry.critical_section do
      show_result(result)
    end

    # Automatically flush after each line
    Volt::Computation.flush!
  end
end

module Volt
  class Console
    def self.start
      require 'pry'

      $LOAD_PATH << 'lib'
      ENV['SERVER'] = 'true'

      require 'volt'
      require 'volt/boot'
      require 'volt/server/socket_connection_handler_stub'

      SocketConnectionHandlerStub.dispatcher = Dispatcher.new

      Volt.boot(Dir.pwd)

      Pry.config.prompt_name = 'volt'

      # start a REPL session
      # Pry.start

      $page.pry
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
volt-0.8.15 lib/volt/console.rb