Class: RSpec::SQLimit::Reporter
- Inherits:
-
Object
- Object
- RSpec::SQLimit::Reporter
- Defined in:
- lib/rspec/sqlimit/reporter.rb
Instance Attribute Summary collapse
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(counter) ⇒ Reporter
constructor
A new instance of Reporter.
Constructor Details
#initialize(counter) ⇒ Reporter
Returns a new instance of Reporter.
5 6 7 8 9 10 |
# File 'lib/rspec/sqlimit/reporter.rb', line 5 def initialize(counter) @counter = counter @count = counter.count @queries = counter.queries @matcher = counter.matcher end |
Instance Attribute Details
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
3 4 5 |
# File 'lib/rspec/sqlimit/reporter.rb', line 3 def matcher @matcher end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/rspec/sqlimit/reporter.rb', line 12 def call suffix = " among others (see mark ->)" if @matcher return "No queries were invoked" if @queries.empty? <<-MESSAGE.gsub(/ +\|/, "") |The following #{@count} queries were invoked#{suffix}: |#{lines.join("\n")} MESSAGE end |