Class: SimpleCov::Formatter::ShadowbqBadgeFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/shadowbq-simplecov-badge/version.rb,
lib/shadowbq-simplecov-badge/formatter.rb

Constant Summary collapse

VERSION =
"2.0.4"

Instance Method Summary collapse

Constructor Details

#initialize(output = nil) ⇒ ShadowbqBadgeFormatter

Returns a new instance of ShadowbqBadgeFormatter.



24
25
26
# File 'lib/shadowbq-simplecov-badge/formatter.rb', line 24

def initialize(output = nil)
  @output = output || STDOUT
end

Instance Method Details

#format(result) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/shadowbq-simplecov-badge/formatter.rb', line 28

def format(result)
  begin
    check_imagemagick
    generate_header_badge(result)
    generate_group_badges(result) if @@generate_groups
    generate_timestamp if @@timestamp
    @output.puts output_message(result)
  rescue ImageMagickError => e
   @output.puts e.message
   @output.puts "Simplecov-Badge was unable to generate a badge for #{result.command_name}."
  end
end