Class: Orb::Runner
- Inherits:
-
Object
- Object
- Orb::Runner
- Defined in:
- lib/orb/runner.rb
Class Attribute Summary collapse
-
.current ⇒ Object
Returns the value of attribute current.
Instance Attribute Summary collapse
-
#source_file ⇒ Object
readonly
Returns the value of attribute source_file.
-
#source_line ⇒ Object
readonly
Returns the value of attribute source_line.
-
#test_buffer ⇒ Object
readonly
Returns the value of attribute test_buffer.
Instance Method Summary collapse
-
#initialize(context, source_location) ⇒ Runner
constructor
A new instance of Runner.
- #parse_source_location(source_location) ⇒ Object
- #run ⇒ Object
- #setup_pry ⇒ Object
Constructor Details
#initialize(context, source_location) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 15 16 |
# File 'lib/orb/runner.rb', line 11 def initialize(context, source_location) @context = context @test_buffer = TestBuffer.new(*parse_source_location(source_location)) setup_pry Orb::Runner.current = self end |
Class Attribute Details
.current ⇒ Object
Returns the value of attribute current.
8 9 10 |
# File 'lib/orb/runner.rb', line 8 def current @current end |
Instance Attribute Details
#source_file ⇒ Object (readonly)
Returns the value of attribute source_file.
5 6 7 |
# File 'lib/orb/runner.rb', line 5 def source_file @source_file end |
#source_line ⇒ Object (readonly)
Returns the value of attribute source_line.
5 6 7 |
# File 'lib/orb/runner.rb', line 5 def source_line @source_line end |
#test_buffer ⇒ Object (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
#parse_source_location(source_location) ⇒ Object
18 19 20 21 |
# File 'lib/orb/runner.rb', line 18 def parse_source_location(source_location) source_location.scan(/(.*):(\d)+:.*/) [$1, $2.to_i] end |
#run ⇒ Object
36 37 38 |
# File 'lib/orb/runner.rb', line 36 def run @pry.repl(@context) end |
#setup_pry ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/orb/runner.rb', line 23 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 |