Class: ReportCard::Report
- Inherits:
-
Object
- Object
- ReportCard::Report
- Defined in:
- lib/report_card/report.rb
Defined Under Namespace
Classes: ReportNotFound
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Report
constructor
A new instance of Report.
Constructor Details
#initialize(params) ⇒ Report
Returns a new instance of Report.
24 25 26 |
# File 'lib/report_card/report.rb', line 24 def initialize(params) self.params = params end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/report_card/report.rb', line 3 def params @params end |
Class Method Details
.all ⇒ Object
7 8 9 |
# File 'lib/report_card/report.rb', line 7 def self.all subclasses end |
.exists?(name) ⇒ Boolean
20 21 22 |
# File 'lib/report_card/report.rb', line 20 def self.exists?(name) all.any? { |r| r.name == name } end |
.find(name) ⇒ Object
15 16 17 18 |
# File 'lib/report_card/report.rb', line 15 def self.find(name) fail ReportNotFound, "Report #{name} not found" unless exists?(name) name.constantize end |
.human_name ⇒ Object
11 12 13 |
# File 'lib/report_card/report.rb', line 11 def self.human_name name.titleize end |