class Spinach::Parser

Parser leverages GherkinRuby to parse the feature definition.

Attributes

content[R]

Gets the plain text content out of the feature file.

@return [String]

The plain feature content.

@api public

Public Class Methods

new(content) click to toggle source

@param [String] content

The content to parse.

@api public

# File lib/spinach/parser.rb, line 12
def initialize(content)
  @content = content
end
open_file(filename) click to toggle source

@param [String] filename

The filename to parse.

@api public

# File lib/spinach/parser.rb, line 20
def self.open_file(filename)
  new File.read(filename)
end

Public Instance Methods

parse() click to toggle source

Parses the feature file and returns a Feature.

@return [Feature]

The Feature.

@api public

# File lib/spinach/parser.rb, line 38
def parse
  ast = GherkinRuby.parse(@content + "\n")
  Visitor.new.visit(ast)
end