Class: Cucumber::Formatter::LegacyApi::Ast::HookResult

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

Instance Method Summary collapse

Constructor Details

#initialize(result, messages, embeddings) ⇒ HookResult

Returns a new instance of HookResult



69
70
71
72
# File 'lib/cucumber/formatter/legacy_api/ast.rb', line 69

def initialize(result, messages, embeddings)
  @result, @messages, @embeddings = result, messages, embeddings
  @already_accepted = false
end

Instance Method Details

#accept(formatter) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/cucumber/formatter/legacy_api/ast.rb', line 74

def accept(formatter)
  unless @already_accepted
    send_output_to(formatter)
    describe_exception_to(formatter)
  end
  self
end

#describe_exception_to(formatter) ⇒ Object



88
89
90
91
92
# File 'lib/cucumber/formatter/legacy_api/ast.rb', line 88

def describe_exception_to(formatter)
  return if @already_accepted
  @result.describe_exception_to(formatter)
  @already_accepted = true
end

#send_output_to(formatter) ⇒ Object



82
83
84
85
86
# File 'lib/cucumber/formatter/legacy_api/ast.rb', line 82

def send_output_to(formatter)
  return if @already_accepted
  @messages.each { |message| formatter.puts(message) }
  @embeddings.each { |embedding| embedding.send_to_formatter(formatter) }
end