class Greener::Parser
Wrapper around Gherkin3's Parser
Public Class Methods
new(feature)
click to toggle source
# File lib/greener/parser.rb, line 7 def initialize(feature) @feature = feature # filepath or String end
Public Instance Methods
ast()
click to toggle source
Return an Abstract Syntax Tree from a feature file
# File lib/greener/parser.rb, line 12 def ast parser = Gherkin::Parser.new if @feature.include?("Feature:") parser.parse(Gherkin::TokenScanner.new(@feature)) else parser.parse(Gherkin::TokenScanner.new(File.read(@feature)))[:feature] end end