Class: TestBench::Controls::KernelSubstitute

Inherits:
Object
  • Object
show all
Defined in:
lib/test_bench/controls/kernel_substitute.rb

Defined Under Namespace

Modules: FileMap, Files, TestScript

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_map) ⇒ KernelSubstitute

Returns a new instance of KernelSubstitute.



13
14
15
# File 'lib/test_bench/controls/kernel_substitute.rb', line 13

def initialize file_map
  @file_map = file_map
end

Instance Attribute Details

#file_mapObject (readonly)

Returns the value of attribute file_map.



11
12
13
# File 'lib/test_bench/controls/kernel_substitute.rb', line 11

def file_map
  @file_map
end

Class Method Details

.example(file_map = nil) ⇒ Object



4
5
6
7
8
9
# File 'lib/test_bench/controls/kernel_substitute.rb', line 4

def self.example file_map=nil
  file_map ||= FileMap.example

  instance = new file_map
  instance
end

Instance Method Details

#load(path) ⇒ Object



17
18
19
20
21
# File 'lib/test_bench/controls/kernel_substitute.rb', line 17

def load path
  ruby_text = file_map[path]

  TOPLEVEL_BINDING.eval ruby_text, path
end