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.
54 55 56 57 |
# File 'lib/turbo_test/configuration.rb', line 54 def initialize(configuration, base) @configuration = configuration @base = base end |
Instance Attribute Details
#path ⇒ Object (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, **) # 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
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 |