class Gherkin::TokenFormatterBuilder
Public Class Methods
Public Instance Methods
Source
# File lib/gherkin/token_formatter_builder.rb, line 13 def build(token) tokens << token end
Source
# File lib/gherkin/token_formatter_builder.rb, line 19 def end_rule(_rule_type); end
Source
# File lib/gherkin/token_formatter_builder.rb, line 21 def get_result tokens.map { |token| "#{format_token(token)}\n" }.join end
Source
# File lib/gherkin/token_formatter_builder.rb, line 17 def start_rule(_rule_type); end
Private Instance Methods
Source
# File lib/gherkin/token_formatter_builder.rb, line 31 def format_token(token) return 'EOF' if token.eof? sprintf( "(%s:%s)%s:%s/%s/%s", token.location[:line], token.location[:column], token.matched_type, token.matched_keyword ? sprintf("(%s)%s", token.matched_keyword_type, token.matched_keyword) : "", token.matched_text, Array(token.matched_items).map { |i| "#{i.column}:#{i.text}" }.join(',') ) end
Source
# File lib/gherkin/token_formatter_builder.rb, line 27 def tokens @tokens ||= [] end