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.



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

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

Instance Attribute Details

#jobsObject

Returns the value of attribute jobs.



35
36
37
# File 'lib/turbo_test/configuration.rb', line 35

def jobs
  @jobs
end

#loadedObject

Returns the value of attribute loaded.



33
34
35
# File 'lib/turbo_test/configuration.rb', line 33

def loaded
  @loaded
end

#workerObject

Returns the value of attribute worker.



34
35
36
# File 'lib/turbo_test/configuration.rb', line 34

def worker
  @worker
end

Instance Method Details

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



62
63
64
65
66
67
68
# File 'lib/turbo_test/configuration.rb', line 62

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

#finalize!Object



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

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

#load(path) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/turbo_test/configuration.rb', line 37

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



51
52
53
54
55
56
57
58
# File 'lib/turbo_test/configuration.rb', line 51

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