class Gherkin::Stream::SourceEvents

Public Class Methods

new(paths) click to toggle source
# File lib/gherkin/stream/source_events.rb, line 4
def initialize(paths)
  @paths = paths
end

Public Instance Methods

enum() click to toggle source
# File lib/gherkin/stream/source_events.rb, line 8
def enum
  Enumerator.new do |y|
    @paths.each do |path|
      event = {
        'type' => 'source',
        'uri' => path,
        'data' => File.open(path, 'r:UTF-8', &:read),
        'media' => {
          'encoding' => 'utf-8',
          'type' => 'text/vnd.cucumber.gherkin+plain'
        }
      }
      y.yield(event)
    end
  end
end