Class: RouteGuard::Models::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/route_guard/models/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(routes = []) ⇒ Report

Returns a new instance of Report.



8
9
10
11
12
13
14
# File 'lib/route_guard/models/report.rb', line 8

def initialize(routes = [])
  @routes = routes
  @issues = []
  @stats = {}
  @complexity_score = 100
  @duration = 0.0
end

Instance Attribute Details

#complexity_scoreObject

Returns the value of attribute complexity_score.



6
7
8
# File 'lib/route_guard/models/report.rb', line 6

def complexity_score
  @complexity_score
end

#durationObject

Returns the value of attribute duration.



6
7
8
# File 'lib/route_guard/models/report.rb', line 6

def duration
  @duration
end

#issuesObject

Returns the value of attribute issues.



6
7
8
# File 'lib/route_guard/models/report.rb', line 6

def issues
  @issues
end

#routesObject

Returns the value of attribute routes.



6
7
8
# File 'lib/route_guard/models/report.rb', line 6

def routes
  @routes
end

#statsObject

Returns the value of attribute stats.



6
7
8
# File 'lib/route_guard/models/report.rb', line 6

def stats
  @stats
end

Instance Method Details

#errorsObject



16
17
18
# File 'lib/route_guard/models/report.rb', line 16

def errors
  issues.select { |i| i.severity == :error }
end

#passed?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/route_guard/models/report.rb', line 24

def passed?
  errors.empty?
end

#warningsObject



20
21
22
# File 'lib/route_guard/models/report.rb', line 20

def warnings
  issues.select { |i| i.severity == :warning }
end