Class: RailsPerformance::BaseReport
- Inherits:
-
Object
- Object
- RailsPerformance::BaseReport
- Defined in:
- lib/rails_performance/base_report.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#sort ⇒ Object
readonly
Returns the value of attribute sort.
Instance Method Summary collapse
- #collect ⇒ Object
-
#initialize(db, group: nil, sort: nil) ⇒ BaseReport
constructor
A new instance of BaseReport.
- #set_defaults ⇒ Object
Constructor Details
#initialize(db, group: nil, sort: nil) ⇒ BaseReport
5 6 7 8 9 10 11 |
# File 'lib/rails_performance/base_report.rb', line 5 def initialize(db, group: nil, sort: nil) @db = db @group = group @sort = sort set_defaults end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
3 4 5 |
# File 'lib/rails_performance/base_report.rb', line 3 def db @db end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
3 4 5 |
# File 'lib/rails_performance/base_report.rb', line 3 def group @group end |
#sort ⇒ Object (readonly)
Returns the value of attribute sort.
3 4 5 |
# File 'lib/rails_performance/base_report.rb', line 3 def sort @sort end |
Instance Method Details
#collect ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rails_performance/base_report.rb', line 13 def collect db.group_by(group).values.inject([]) do |res, (k,v)| res << yield(k, v) res end end |
#set_defaults ⇒ Object
20 21 |
# File 'lib/rails_performance/base_report.rb', line 20 def set_defaults end |