Class: Orb::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/runner.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Runner

Returns a new instance of Runner.



10
11
12
13
14
15
# File 'lib/orb/runner.rb', line 10

def initialize(context)
  @context = context
  @test_buffer = TestBuffer.new
  setup_pry
  Orb::Runner.current = self
end

Class Attribute Details

.currentObject

Returns the value of attribute current.



7
8
9
# File 'lib/orb/runner.rb', line 7

def current
  @current
end

Instance Attribute Details

#test_bufferObject (readonly)

Returns the value of attribute test_buffer.



5
6
7
# File 'lib/orb/runner.rb', line 5

def test_buffer
  @test_buffer
end

Instance Method Details

#runObject



30
31
32
# File 'lib/orb/runner.rb', line 30

def run
  @pry.repl(@context)
end

#setup_pryObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/orb/runner.rb', line 17

def setup_pry
  Pry.instance_eval do
    if initial_session?
      load_rc       if Pry.config.should_load_rc
      # load_plugins  if Pry.config.plugins.enabled
      load_requires if Pry.config.should_load_requires
      load_history  if Pry.config.history.should_load
    end
  end
  @pry = Pry.new
  @pry.instance_variable_set("@orb_test_buffer", @test_buffer)
end