Class: TurboTest::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo_test/configuration.rb

Defined Under Namespace

Classes: Loader

Constant Summary collapse

DEFAULT_JOB_CLASSES =
[RSpec::Job]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
# File 'lib/turbo_test/configuration.rb', line 10

def initialize
	@loaded = false
	@worker = nil
	@jobs = []
end

Instance Attribute Details

#jobsObject

Returns the value of attribute jobs.



18
19
20
# File 'lib/turbo_test/configuration.rb', line 18

def jobs
  @jobs
end

#loadedObject

Returns the value of attribute loaded.



16
17
18
# File 'lib/turbo_test/configuration.rb', line 16

def loaded
  @loaded
end

#workerObject

Returns the value of attribute worker.



17
18
19
# File 'lib/turbo_test/configuration.rb', line 17

def worker
  @worker
end

Instance Method Details

#defaults!(pwd = Dir.pwd) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/turbo_test/configuration.rb', line 45

def defaults!(pwd = Dir.pwd)
	loader = Loader.new(self, pwd)
	
	loader.defaults!
	
	return loader
end

#finalize!Object



28
29
30
31
32
# File 'lib/turbo_test/configuration.rb', line 28

def finalize!
	unless @loaded
		self.defaults!
	end
end

#load(path) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/turbo_test/configuration.rb', line 20

def load(path)
	loader = Loader.new(self, File.dirname(path))
	
	loader.instance_eval(File.read(path), path.to_s)
	
	return loader
end

#queue(matching) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/turbo_test/configuration.rb', line 34

def queue(matching)
	if matching.nil? or matching.empty?
		# No filtering required, return all jobs:
		return @jobs.dup
	else
		return @jobs.select{|klass, path| matching.include?(path)}
	end
end