Class: Testament::Report::Base
- Inherits:
-
Object
- Object
- Testament::Report::Base
- Defined in:
- lib/testament/report/base.rb
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
Instance Method Summary collapse
- #dataset ⇒ Object
- #headers ⇒ Object
-
#initialize(database) ⇒ Base
constructor
A new instance of Base.
- #result_set ⇒ Object
- #rows ⇒ Object
Constructor Details
#initialize(database) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/testament/report/base.rb', line 6 def initialize(database) @database = database end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
4 5 6 |
# File 'lib/testament/report/base.rb', line 4 def database @database end |
Instance Method Details
#dataset ⇒ Object
22 23 24 |
# File 'lib/testament/report/base.rb', line 22 def dataset raise NotImplementedError end |
#headers ⇒ Object
10 11 12 |
# File 'lib/testament/report/base.rb', line 10 def headers @headers ||= dataset.columns.map(&:to_s).map(&:humanize) end |
#result_set ⇒ Object
18 19 20 |
# File 'lib/testament/report/base.rb', line 18 def result_set @result_set ||= dataset.all end |
#rows ⇒ Object
14 15 16 |
# File 'lib/testament/report/base.rb', line 14 def rows @rows ||= result_set.map(&:values) end |