Class: TurboTest::Configuration::Loader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, base) ⇒ Loader

Returns a new instance of Loader.



54
55
56
57
# File 'lib/turbo_test/configuration.rb', line 54

def initialize(configuration, base)
	@configuration = configuration
	@base = base
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



59
60
61
# File 'lib/turbo_test/configuration.rb', line 59

def path
  @path
end

Instance Method Details

#add_jobs_matching(klass, pattern: klass::PATTERN, **options) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/turbo_test/configuration.rb', line 65

def add_jobs_matching(klass, pattern: klass::PATTERN, **options)
	# This indicates that someone has added jobs:
	@configuration.loaded = true
	
	Dir.glob(pattern, base: @base) do |path|
		path = File.expand_path(path, @base)
		@configuration.jobs << [klass, path, **options]
	end
end

#defaults!Object



75
76
77
78
79
# File 'lib/turbo_test/configuration.rb', line 75

def defaults!
	DEFAULT_JOB_CLASSES.each do |klass|
		add_jobs_matching(klass)
	end
end

#worker(&block) ⇒ Object



61
62
63
# File 'lib/turbo_test/configuration.rb', line 61

def worker(&block)
	@configuration.worker = block
end