Class: Swagcov::Coverage
- Inherits:
-
Object
- Object
- Swagcov::Coverage
- Defined in:
- lib/swagcov/coverage.rb
Instance Attribute Summary collapse
-
#covered ⇒ Object
readonly
Returns the value of attribute covered.
-
#ignored ⇒ Object
readonly
Returns the value of attribute ignored.
-
#routes_covered ⇒ Object
readonly
Returns the value of attribute routes_covered.
-
#routes_ignored ⇒ Object
readonly
Returns the value of attribute routes_ignored.
-
#routes_not_covered ⇒ Object
readonly
Returns the value of attribute routes_not_covered.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(dotfile: Swagcov::Dotfile.new, routes: ::Rails.application.routes.routes) ⇒ Coverage
constructor
A new instance of Coverage.
- #report ⇒ Object
Constructor Details
#initialize(dotfile: Swagcov::Dotfile.new, routes: ::Rails.application.routes.routes) ⇒ Coverage
Returns a new instance of Coverage.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/swagcov/coverage.rb', line 7 def initialize dotfile: Swagcov::Dotfile.new, routes: ::Rails.application.routes.routes @total = 0 @covered = 0 @ignored = 0 @routes_not_covered = [] @routes_covered = [] @routes_ignored = [] @dotfile = dotfile @routes = routes end |
Instance Attribute Details
#covered ⇒ Object (readonly)
Returns the value of attribute covered.
5 6 7 |
# File 'lib/swagcov/coverage.rb', line 5 def covered @covered end |
#ignored ⇒ Object (readonly)
Returns the value of attribute ignored.
5 6 7 |
# File 'lib/swagcov/coverage.rb', line 5 def ignored @ignored end |
#routes_covered ⇒ Object (readonly)
Returns the value of attribute routes_covered.
5 6 7 |
# File 'lib/swagcov/coverage.rb', line 5 def routes_covered @routes_covered end |
#routes_ignored ⇒ Object (readonly)
Returns the value of attribute routes_ignored.
5 6 7 |
# File 'lib/swagcov/coverage.rb', line 5 def routes_ignored @routes_ignored end |
#routes_not_covered ⇒ Object (readonly)
Returns the value of attribute routes_not_covered.
5 6 7 |
# File 'lib/swagcov/coverage.rb', line 5 def routes_not_covered @routes_not_covered end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
5 6 7 |
# File 'lib/swagcov/coverage.rb', line 5 def total @total end |
Instance Method Details
#report ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/swagcov/coverage.rb', line 18 def report collect_coverage routes_output(@routes_covered, "green") routes_output(@routes_ignored, "yellow") routes_output(@routes_not_covered, "red") final_output @total - @covered end |