class Cucumber::Core::Gherkin::AstBuilder::Builder
def children
def children [] end
def description
def description attributes[:description] ||= "" end
def handle_comments(comments)
def handle_comments(comments) remaining_comments = [] comments.each do |comment| if line > comment.location.line @comments << comment else remaining_comments << comment end end children.each { |child| remaining_comments = child.handle_comments(remaining_comments) } remaining_comments end
def initialize(file, attributes)
def initialize(file, attributes) @file = file @attributes = rubify_keys(attributes.dup) @comments = [] @line = @attributes[:location][:line] end
def keyword
def keyword attributes[:keyword] end
def location
def location Ast::Location.new(file, attributes[:location][:line]) end
def name
def name attributes[:name] end
def rubify_keys(hash)
def rubify_keys(hash) hash.keys.each do |key| if key.downcase != key hash[underscore(key).to_sym] = hash.delete(key) end end return hash end
def tags
def tags attributes[:tags].map do |tag| Ast::Tag.new( Ast::Location.new(file, tag[:location][:line]), tag[:name]) end end
def underscore(string)
def underscore(string) string.to_s.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end