Class: Leftovers::MergedConfig
- Inherits:
-
Object
- Object
- Leftovers::MergedConfig
- Defined in:
- lib/leftovers/merged_config.rb
Constant Summary collapse
- MEMOIZED_IVARS =
%i{ @exclude_paths @include_paths @test_paths @precompilers @dynamic @keep @test_only }.freeze
Instance Method Summary collapse
- #<<(config) ⇒ Object
- #dynamic ⇒ Object
- #exclude_paths ⇒ Object
- #include_paths ⇒ Object
-
#initialize(load_defaults: false) ⇒ MergedConfig
constructor
A new instance of MergedConfig.
- #keep ⇒ Object
- #precompilers ⇒ Object
- #test_only ⇒ Object
- #test_paths ⇒ Object
Constructor Details
#initialize(load_defaults: false) ⇒ MergedConfig
Returns a new instance of MergedConfig.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/leftovers/merged_config.rb', line 18 def initialize(load_defaults: false) @configs = [] @loaded_configs = ::Set.new.compare_by_identity return unless load_defaults self << :ruby self << :leftovers self << project_config self << project_todo load_bundled_gem_config end |
Instance Method Details
#<<(config) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/leftovers/merged_config.rb', line 30 def <<(config) config = Config[config] return if @loaded_configs.include?(config.name) unmemoize @configs << config @loaded_configs << config.name config.gems.each { |gem| self << gem } require_requires(config) end |
#dynamic ⇒ Object
58 59 60 |
# File 'lib/leftovers/merged_config.rb', line 58 def dynamic @dynamic ||= ProcessorBuilders::Each.build(@configs.map(&:dynamic)) end |
#exclude_paths ⇒ Object
42 43 44 |
# File 'lib/leftovers/merged_config.rb', line 42 def exclude_paths @exclude_paths ||= @configs.flat_map(&:exclude_paths) end |
#include_paths ⇒ Object
46 47 48 |
# File 'lib/leftovers/merged_config.rb', line 46 def include_paths @include_paths ||= @configs.flat_map(&:include_paths) end |
#keep ⇒ Object
62 63 64 |
# File 'lib/leftovers/merged_config.rb', line 62 def keep @keep ||= MatcherBuilders::Or.build(@configs.map(&:keep)) end |
#precompilers ⇒ Object
54 55 56 |
# File 'lib/leftovers/merged_config.rb', line 54 def precompilers @precompilers ||= Precompilers.build(@configs.flat_map(&:precompile)) end |
#test_only ⇒ Object
66 67 68 |
# File 'lib/leftovers/merged_config.rb', line 66 def test_only @test_only ||= MatcherBuilders::Or.build(@configs.map(&:test_only)) end |
#test_paths ⇒ Object
50 51 52 |
# File 'lib/leftovers/merged_config.rb', line 50 def test_paths @test_paths ||= MatcherBuilders::Path.build(@configs.flat_map(&:test_paths)) end |