Class: Sitepress::REPL

Inherits:
Object
  • Object
show all
Defined in:
lib/sitepress/repl.rb

Overview

Interactive REPL for Sitepress project

Instance Method Summary collapse

Constructor Details

#initialize(context:) ⇒ REPL

Returns a new instance of REPL.



6
7
8
# File 'lib/sitepress/repl.rb', line 6

def initialize(context:)
  @context = context
end

Instance Method Details

#startObject

Start interactive REPL.



11
12
13
14
15
16
17
# File 'lib/sitepress/repl.rb', line 11

def start
  IRB.setup nil
  IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
  IRB.conf[:PROMPT_MODE] = :SIMPLE
  require 'irb/ext/multi-irb'
  IRB.irb nil, @context
end