Class: SimpleCov::Badger::Formatter
- Inherits:
-
Object
- Object
- SimpleCov::Badger::Formatter
- Defined in:
- lib/simplecov_badger/formatter.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #format(result) ⇒ Object
-
#initialize(output = nil) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(output = nil) ⇒ Formatter
Returns a new instance of Formatter.
5 6 7 8 |
# File 'lib/simplecov_badger/formatter.rb', line 5 def initialize(output = nil) @output = output || STDOUT @config = SimpleCov::Badger.configuration end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/simplecov_badger/formatter.rb', line 3 def config @config end |
Instance Method Details
#format(result) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/simplecov_badger/formatter.rb', line 10 def format(result) if config.run_if.call RestClient.patch( config.badge_url, { percentage: result.source_files.covered_percent.round(2), token: config.token } ) puts "SimpleCov::Badger: Your badge can be found at: #{config.badge_url}" end end |