### Home Classes Methods

### In Files

- lib/gherkin/parser/formatter_listener.rb

### Parent

Object

### Methods

- ::new
- #background
- #comment
- #eof
- #examples
- #feature
- #location
- #py_string
- #row
- #scenario
- #scenario_outline
- #step
- #tag

### Files

- LICENSE
- README.rdoc
- meta.txt
- root.txt
- steps.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Gherkin
- Gherkin::CLexer
- Gherkin::Cli
- Gherkin::Cli::Main
- Gherkin::Formatter
- Gherkin::Formatter::Argument
- Gherkin::Formatter::Colors
- Gherkin::Formatter::Escaping
- Gherkin::Formatter::JSONFormatter
- Gherkin::Formatter::MonochromeFormat
- Gherkin::Formatter::PrettyFormatter
- Gherkin::I18n
- Gherkin::I18nLexer
- Gherkin::JSONLexer
- Gherkin::Parser
- Gherkin::Parser::Event
- Gherkin::Parser::FilterListener
- Gherkin::Parser::FormatterListener
- Gherkin::Parser::ParseError
- Gherkin::Parser::Parser
- Gherkin::Parser::Parser::Machine
- Gherkin::Parser::Parser::Machine::StateMachineReader
- Gherkin::Parser::Row
- Gherkin::Parser::TagExpression
- Gherkin::RbLexer
- Gherkin::Rubify
- Gherkin::Tools
- Gherkin::Tools::Files
- Gherkin::Tools::Reformat
- Gherkin::Tools::Stats
- Gherkin::Tools::StatsListener
- Class

No matching classes.

# Gherkin::Parser::FormatterListener

Adapter from the “raw” Gherkin `Listener` API to the slightly more high-level `Formatter` API, which is easier to implement (less state to keep track of).

### Public Class Methods

new(formatter) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 12
    def initialize(formatter)
      @formatter = formatter
      @comments = []
      @tags = []
      @table = nil
    end

### Public Instance Methods

background(keyword, name, description, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 36
    def background(keyword, name, description, line)
      @formatter.background(grab_comments!, keyword, name, description, line)
    end

comment(content, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 24
    def comment(content, line)
      @comments << content
    end

eof() click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 69
    def eof
      replay_step_or_examples
      @formatter.eof
    end

examples(keyword, name, description, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 50
    def examples(keyword, name, description, line)
      replay_step_or_examples
      @examples = [grab_comments!, grab_tags!, keyword, name, description, line]
    end

feature(keyword, name, description, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 32
    def feature(keyword, name, description, line)
      @formatter.feature(grab_comments!, grab_tags!, keyword, name, description, @uri)
    end

location(uri, offset) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 19
    def location(uri, offset)
      @uri = uri
      @offset = offset
    end

py_string(py_string, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 65
    def py_string(py_string, line)
      @py_string = py_string
    end

row(cells, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 60
    def row(cells, line)
      @table ||= []
      @table << Row.new(cells, grab_comments!, line)
    end

scenario(keyword, name, description, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 40
    def scenario(keyword, name, description, line)
      replay_step_or_examples
      @formatter.scenario(grab_comments!, grab_tags!, keyword, name, description, line)
    end

scenario_outline(keyword, name, description, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 45
    def scenario_outline(keyword, name, description, line)
      replay_step_or_examples
      @formatter.scenario_outline(grab_comments!, grab_tags!, keyword, name, description, line)
    end

step(keyword, name, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 55
    def step(keyword, name, line)
      replay_step_or_examples
      @step = [grab_comments!, keyword, name, line]
    end

tag(name, line) click to toggle source

    # File lib/gherkin/parser/formatter_listener.rb, line 28
    def tag(name, line)
      @tags << name
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.