class Gherkin::TokenFormatterBuilder
Public Class Methods
new()
click to toggle source
# File lib/gherkin/token_formatter_builder.rb, line 3 def initialize reset end
Public Instance Methods
build(token)
click to toggle source
# File lib/gherkin/token_formatter_builder.rb, line 11 def build(token) @tokens_text << "#{format_token(token)}\n" end
end_rule(rule_type)
click to toggle source
# File lib/gherkin/token_formatter_builder.rb, line 18 def end_rule(rule_type) end
get_result()
click to toggle source
# File lib/gherkin/token_formatter_builder.rb, line 21 def get_result @tokens_text end
reset()
click to toggle source
# File lib/gherkin/token_formatter_builder.rb, line 7 def reset @tokens_text = "" end
start_rule(rule_type)
click to toggle source
# File lib/gherkin/token_formatter_builder.rb, line 15 def start_rule(rule_type) end
Private Instance Methods
format_token(token)
click to toggle source
# File lib/gherkin/token_formatter_builder.rb, line 26 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, token.matched_text, Array(token.matched_items).map { |i| "#{i.column}:#{i.text}"}.join(',') end