Sha256: 76e09246f8b31873c44bf9c108ebdf7d4274b95b2a31cf9f9581010925ed4630

Contents?: true

Size: 694 Bytes

Versions: 49

Compression:

Stored size: 694 Bytes

Contents

module Gherkin
  class TokenFormatterBuilder
    def initialize
      reset
    end

    def reset
      @tokens_text = ""
    end

    def build(token)
      @tokens_text << "#{format_token(token)}\n"
    end

    def start_rule(rule_type)
    end

    def end_rule(rule_type)
    end

    def get_result
      @tokens_text
    end

    private
    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

  end
end

Version data entries

49 entries across 49 versions & 5 rubygems

Version Path
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/lib/gherkin/token_formatter_builder.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/lib/gherkin/token_formatter_builder.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/lib/gherkin/token_formatter_builder.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-23.0.1 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-23.0.0 lib/gherkin/token_formatter_builder.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-gherkin-22.0.0/lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-22.0.0 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-21.0.0 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-20.0.1 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-20.0.0 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-19.0.3 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-19.0.2 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-19.0.1 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-19.0.0 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-18.1.1 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-18.1.0 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-18.0.0 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-17.0.2 lib/gherkin/token_formatter_builder.rb
cucumber-gherkin-17.0.1 lib/gherkin/token_formatter_builder.rb