Class: Evilution::SpecSelector Private
- Inherits:
-
Object
- Object
- Evilution::SpecSelector
- Defined in:
- lib/evilution/spec_selector.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #call(source_path) ⇒ Object private
-
#initialize(spec_files: [], spec_mappings: {}, spec_pattern: nil, spec_resolver: Evilution::SpecResolver.new) ⇒ SpecSelector
constructor
private
A new instance of SpecSelector.
Constructor Details
#initialize(spec_files: [], spec_mappings: {}, spec_pattern: nil, spec_resolver: Evilution::SpecResolver.new) ⇒ SpecSelector
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SpecSelector.
6 7 8 9 10 11 |
# File 'lib/evilution/spec_selector.rb', line 6 def initialize(spec_files: [], spec_mappings: {}, spec_pattern: nil, spec_resolver: Evilution::SpecResolver.new) @spec_files = Array(spec_files) @spec_mappings = spec_mappings || {} @spec_pattern = spec_pattern @spec_resolver = spec_resolver end |
Instance Method Details
#call(source_path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/evilution/spec_selector.rb', line 13 def call(source_path) return @spec_files unless @spec_files.empty? mapped = mapping_for(source_path) if mapped existing = mapped.select { |path| project_relative_exists?(path) } return existing unless existing.empty? end resolved = resolve_via_resolver(source_path) resolved && !resolved.empty? ? resolved : nil end |