Sha256: c3ed3a9d9f33be9b74cc6a1b2d062914458472687747a5022bbebca10d6b6cbe

Contents?: true

Size: 779 Bytes

Versions: 21

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true
require 'stringio'

include Handlers

def undoc_error(code)
  expect { StubbedSourceParser.parse_string(code) }.to raise_error(Parser::UndocumentableError)
end

def with_parser(parser_type)
  tmp = StubbedSourceParser.parser_type
  StubbedSourceParser.parser_type = parser_type
  yield
  StubbedSourceParser.parser_type = tmp
end

class StubbedProcessor < Processor
  def process(statements)
    statements.each_with_index do |stmt, _index|
      find_handlers(stmt).each do |handler|
        handler.new(self, stmt).process
      end
    end
  end
end

class StubbedSourceParser < Parser::SourceParser
  StubbedSourceParser.parser_type = :ruby
  def post_process
    post = StubbedProcessor.new(self)
    post.process(@parser.enumerator)
  end
end

Version data entries

21 entries across 20 versions & 4 rubygems

Version Path
yard-0.9.6 spec/handlers/spec_helper.rb