Module: IRT::Directives
- Extended by:
- Directives, Test
- Included in:
- Directives
- Defined in:
- lib/irt/directives.rb,
lib/irt/directives/test.rb
Defined Under Namespace
Modules: Test
Instance Method Summary collapse
-
#eval_file(file_path) ⇒ Object
(also: #insert_file)
Evaluate a file as it were inserted at that line a relative file_path is considered to be relative to the including file i.e.
- #irt_at_exit(&block) ⇒ Object
Methods included from Test
_eql?, _yaml_eql?, desc, load_helper_files, reset_variables, test_summary
Instance Method Details
#eval_file(file_path) ⇒ Object Also known as: insert_file
Evaluate a file as it were inserted at that line a relative file_path is considered to be relative to the including file i.e. ‘../file_in_the_same_dir.irt’
12 13 14 15 16 17 18 19 20 |
# File 'lib/irt/directives.rb', line 12 def eval_file(file_path) parent_context = IRB.CurrentContext new_io = IRB::FileInputMethod.new(File.(file_path, parent_context.io.file_name)) new_irb = IRB::Irb.new(parent_context.workspace, new_io) new_irb.context.irb_name = File.basename(new_io.file_name) new_irb.context.irb_path = new_io.file_name IRT::Session.eval_input(new_irb.context, :file) IRT::Session.exit end |