Sha256: 5eb1c6a45284d784d467879a34890ea7b2a9b94c78b64ec969ff944fe1503f22

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

module JupyterOnRails
  class Kernel
    def initialize(sandbox: false)
      @root = ENV.fetch('RAILS_ROOT')
      @sandbox = sandbox
    end

    def boot
      boot_rails
      load_extensions
    end

    private

    def boot_rails
      boot_file = File.expand_path('config/boot.rb', @root)
      require boot_file
    end

    def load_extensions
      require_relative 'iruby_kernel_extention'
      JupyterOnRails::IRubyKernelExtention.root = @root
      JupyterOnRails::IRubyKernelExtention.sandbox = @sandbox

      require 'iruby'
      IRuby::Kernel.instance_eval { prepend JupyterOnRails::IRubyKernelExtention }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jupyter_on_rails-0.7.0 lib/jupyter_on_rails/kernel.rb