Sha256: 23a854f386af5a4089ab0e03a1d8b9dbfd6d86763722bf702f97c122a6246ac2

Contents?: true

Size: 560 Bytes

Versions: 2

Compression:

Stored size: 560 Bytes

Contents

require "gherkin/parser"
require 'turnip/node/feature'

module Turnip
  class Builder

    attr_reader :features

    class << self
      def build(feature_file)
        Turnip::Builder.new.tap do |builder|
          parser = Gherkin::Parser.new
          result = parser.parse(File.read(feature_file))
          builder.build(result)
        end
      end
    end

    def initialize
      @features = []
    end

    def build(attributes)
      return unless attributes[:feature]

      @features << Node::Feature.new(attributes[:feature])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turnip-3.0.0.pre.beta.3 lib/turnip/builder.rb
turnip-3.0.0.pre.beta.2 lib/turnip/builder.rb