Class: RubyLens::Index::RSpecExtractor
- Inherits:
-
Object
- Object
- RubyLens::Index::RSpecExtractor
- Defined in:
- lib/rubylens/index/rspec_extractor.rb
Defined Under Namespace
Constant Summary collapse
- GROUP_METHODS =
Set.new(%w[describe context]).freeze
- EXAMPLE_METHODS =
Set.new(%w[it specify]).freeze
- SPEC_SEGMENTS =
Set.new(%w[spec specs]).freeze
- PROXY_NAME_PREFIX =
"RSpec example group #"
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(graph:, manifest:, package_document_paths: Set.new) ⇒ RSpecExtractor
constructor
A new instance of RSpecExtractor.
Constructor Details
#initialize(graph:, manifest:, package_document_paths: Set.new) ⇒ RSpecExtractor
Returns a new instance of RSpecExtractor.
17 18 19 20 21 |
# File 'lib/rubylens/index/rspec_extractor.rb', line 17 def initialize(graph:, manifest:, package_document_paths: Set.new) @graph = graph @manifest = manifest @package_document_paths = package_document_paths end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rubylens/index/rspec_extractor.rb', line 23 def call groups = [] method_count = 0 spec_documents.each do |document, relative| group_count, example_count = reference_counts(document.method_references) method_count += example_count component = SourcePath.component_for(relative) group_count.times do groups << Group.new( format("%s%06d", PROXY_NAME_PREFIX, groups.length + 1), component, ) end end Result.new(groups.freeze, method_count) end |