Class: ReportCard::Report

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

Defined Under Namespace

Classes: ReportNotFound

Class Method Summary collapse

Class Method Details

.allObject



5
6
7
# File 'lib/report_card/report.rb', line 5

def self.all
  subclasses
end

.exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/report_card/report.rb', line 18

def self.exists?(name)
  all.any? { |r| r.name == name }
end

.find(name) ⇒ Object



13
14
15
16
# File 'lib/report_card/report.rb', line 13

def self.find(name)
  fail ReportNotFound, "Report #{name} not found" unless exists?(name)
  name.constantize
end

.human_nameObject



9
10
11
# File 'lib/report_card/report.rb', line 9

def self.human_name
  name.titleize
end