Class: TurboTest::Configuration::Loader
- Inherits:
-
Object
- Object
- TurboTest::Configuration::Loader
- Defined in:
- lib/turbo_test/configuration.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #add_jobs_matching(klass, pattern: klass::PATTERN, **options) ⇒ Object
- #defaults! ⇒ Object
-
#initialize(configuration, base) ⇒ Loader
constructor
A new instance of Loader.
- #worker(&block) ⇒ Object
Constructor Details
#initialize(configuration, base) ⇒ Loader
Returns a new instance of Loader.
71 72 73 74 |
# File 'lib/turbo_test/configuration.rb', line 71 def initialize(configuration, base) @configuration = configuration @base = base end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
76 77 78 |
# File 'lib/turbo_test/configuration.rb', line 76 def path @path end |
Instance Method Details
#add_jobs_matching(klass, pattern: klass::PATTERN, **options) ⇒ Object
82 83 84 85 86 87 88 89 90 |
# File 'lib/turbo_test/configuration.rb', line 82 def add_jobs_matching(klass, pattern: klass::PATTERN, **) # This indicates that someone has added jobs: @configuration.loaded = true Dir.glob(pattern, base: @base) do |path| path = File.(path, @base) @configuration.jobs << [klass, path, **] end end |
#defaults! ⇒ Object
92 93 94 95 96 |
# File 'lib/turbo_test/configuration.rb', line 92 def defaults! DEFAULT_JOB_CLASSES.each do |klass| add_jobs_matching(klass) end end |
#worker(&block) ⇒ Object
78 79 80 |
# File 'lib/turbo_test/configuration.rb', line 78 def worker(&block) @configuration.worker = block end |