### Home Classes Methods

### In Files

- lib/gherkin/json_lexer.rb

### Parent

Object

### Methods

- ::new
- #scan

### 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::JSONLexer

### Public Class Methods

new(listener) click to toggle source

    # File lib/gherkin/json_lexer.rb, line 6
    def initialize(listener)
      @listener = listener
    end

### Public Instance Methods

scan(src, uri='unknown.json', offset=0) click to toggle source

    # File lib/gherkin/json_lexer.rb, line 10
    def scan(src, uri='unknown.json', offset=0)
      feature = JSON.parse(src)

      comments_for(feature)
      tags_for(feature)
      multiline_event(:feature, feature)

      if feature["background"]
        comments_for(feature["background"])
        multiline_event(:background, feature["background"])
        steps_for(feature["background"])
      end

      feature["elements"].each do |feature_element|
        parse_element(feature_element)
      end if feature["elements"]

      @listener.eof
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.