class RuboCop::RSpec::ExpectOffense::AnnotatedSource

def self.parse(annotated_source)

Returns:
  • (AnnotatedSource) -

Parameters:
  • annotated_source (String) -- string passed to the matchers
def self.parse(annotated_source)
  source      = []
  annotations = []
  annotated_source.each_line do |source_line|
    if ANNOTATION_PATTERN.match?(source_line)
      annotations << [source.size, source_line]
    else
      source << source_line
    end
  end
  annotations.each { |a| a[0] = 1 } if source.empty?
  new(source, annotations)
end