Class: Cucumber::HTMLFormatter::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/lib/cucumber/html_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out) ⇒ Formatter

Returns a new instance of Formatter.



10
11
12
13
14
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/lib/cucumber/html_formatter.rb', line 10

def initialize(out)
  @out = out
  @pre_message_written = false
  @first_message = true
end

Instance Attribute Details

#outObject (readonly)

Returns the value of attribute out.



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/lib/cucumber/html_formatter.rb', line 8

def out
  @out
end

Instance Method Details

#process_messages(messages) ⇒ Object



16
17
18
19
20
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/lib/cucumber/html_formatter.rb', line 16

def process_messages(messages)
  write_pre_message
  messages.each { |message| write_message(message) }
  write_post_message
end

#write_message(message) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/lib/cucumber/html_formatter.rb', line 29

def write_message(message)
  unless @first_message
    out.puts(',')
  end
  out.print(message.to_json)

  @first_message = false
end

#write_post_messageObject



38
39
40
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/lib/cucumber/html_formatter.rb', line 38

def write_post_message
  out.print(post_message)
end

#write_pre_messageObject



22
23
24
25
26
27
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-html-formatter-19.2.0/lib/cucumber/html_formatter.rb', line 22

def write_pre_message
  return if @pre_message_written

  out.puts(pre_message)
  @pre_message_written = true
end