Parent

Included Modules

Gherkin::Formatter::JSONFormatter

Public Class Methods

new(io) click to toggle source
# File lib/gherkin/formatter/json_formatter.rb, line 10
def initialize(io)
  @io = io
end

Public Instance Methods

background(comments, keyword, name, description, line) click to toggle source
# File lib/gherkin/formatter/json_formatter.rb, line 25
def background(comments, keyword, name, description, line)
  background = {
    'comments' => comments.to_a, 
    'keyword' => keyword, 
    'name' => name, 
    'description' => description,
    'line' => line,
    'steps' => [],
  }
  @json_hash['background'] = background 
  @in_background = true
end
eof() click to toggle source
# File lib/gherkin/formatter/json_formatter.rb, line 59
def eof
  @io.write(@json_hash.to_json)
end
examples(comments, tags, keyword, name, description, line, table) click to toggle source
# File lib/gherkin/formatter/json_formatter.rb, line 48
def examples(comments, tags, keyword, name, description, line, table)
  @table_container = add_examples(comments, tags, keyword, name, description, line)
  @table_container['table'] = to_hash_array(table)
end
feature(comments, tags, keyword, name, description, uri) click to toggle source
# File lib/gherkin/formatter/json_formatter.rb, line 14
def feature(comments, tags, keyword, name, description, uri)
  @json_hash = {
    'comments' => comments.to_a, 
    'tags' => tags.to_a, 
    'keyword' => keyword, 
    'name' => name, 
    'description' => description, 
    'uri' => uri
  }
end
scenario(comments, tags, keyword, name, description, line) click to toggle source
# File lib/gherkin/formatter/json_formatter.rb, line 38
def scenario(comments, tags, keyword, name, description, line)
  @in_background = false
  add_step_container(comments, tags, keyword, name, description, line, 'scenario')
end
scenario_outline(comments, tags, keyword, name, description, line) click to toggle source
# File lib/gherkin/formatter/json_formatter.rb, line 43
def scenario_outline(comments, tags, keyword, name, description, line)
  @in_background = false
  add_step_container(comments, tags, keyword, name, description, line, 'scenario_outline')
end
step(comments, keyword, name, line, multiline_arg, status, exception, arguments, stepdef_location) click to toggle source
# File lib/gherkin/formatter/json_formatter.rb, line 53
def step(comments, keyword, name, line, multiline_arg, status, exception, arguments, stepdef_location)
  @table_container = {'comments' => comments.to_a, 'keyword' => keyword, 'name' => name, 'line' => line}.merge(step_arg_to_hash(multiline_arg))
  last_element['steps'] ||= []
  last_element['steps'] << @table_container
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.