Class: Cucumber::Ast::Examples

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/ast/examples.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(comment, line, keyword, name, outline_table) ⇒ Examples

Returns a new instance of Examples.



4
5
6
# File 'lib/cucumber/ast/examples.rb', line 4

def initialize(comment, line, keyword, name, outline_table)
  @comment, @keyword, @name, @outline_table = comment, keyword, name, outline_table
end

Instance Method Details

#accept(visitor) ⇒ Object



8
9
10
11
12
13
# File 'lib/cucumber/ast/examples.rb', line 8

def accept(visitor)
  return if Cucumber.wants_to_quit
  visitor.visit_comment(@comment) unless @comment.empty?
  visitor.visit_examples_name(@keyword, @name)
  visitor.visit_outline_table(@outline_table)
end

#each_example_row(&proc) ⇒ Object



19
20
21
# File 'lib/cucumber/ast/examples.rb', line 19

def each_example_row(&proc)
  @outline_table.cells_rows[1..-1].each(&proc)
end

#failed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/cucumber/ast/examples.rb', line 23

def failed?
  @outline_table.cells_rows[1..-1].select{|row| row.failed?}.any?
end

#skip_invoke!Object



15
16
17
# File 'lib/cucumber/ast/examples.rb', line 15

def skip_invoke!
  @outline_table.skip_invoke!
end

#to_sexpObject



27
28
29
30
31
32
33
# File 'lib/cucumber/ast/examples.rb', line 27

def to_sexp
  sexp = [:examples, @keyword, @name]
  comment = @comment.to_sexp
  sexp += [comment] if comment
  sexp += [@outline_table.to_sexp]
  sexp
end