Class: Rescuetime::ReportFormatters
- Inherits:
-
Object
- Object
- Rescuetime::ReportFormatters
- Includes:
- Formatters
- Defined in:
- lib/rescuetime/report_formatters.rb
Overview
Represents the collection of report formatters. Autoloads all formatters based on filename and file location.
Constant Summary
Constants included from Formatters
Formatters::BASE_FORMATTER, Formatters::LOCAL_FORMATTER_PATH
Instance Method Summary collapse
-
#all ⇒ Array<String>
Returns a list of available formatter names.
-
#find(name) ⇒ Class
Returns the formatter with the specified name or, if not found, raises an exception.
-
#formatters ⇒ Array<Class>
Returns or loads a memoized list of formatters.
-
#reload ⇒ Array<Class>
Force a reload of report formatters.
Methods included from Formatters
Instance Method Details
#all ⇒ Array<String>
Returns a list of available formatter names
59 60 61 |
# File 'lib/rescuetime/report_formatters.rb', line 59 def all formatters.map(&:name) end |
#find(name) ⇒ Class
Returns the formatter with the specified name or, if not found, raises an exception
70 71 72 73 74 75 |
# File 'lib/rescuetime/report_formatters.rb', line 70 def find(name) formatter = formatters.find do |f| standardize(f.name) == standardize(name) end formatter || raise(Rescuetime::Errors::InvalidFormatError) end |
#formatters ⇒ Array<Class>
Returns or loads a memoized list of formatters
20 21 22 |
# File 'lib/rescuetime/report_formatters.rb', line 20 def formatters @formatters ||= load_formatters end |
#reload ⇒ Array<Class>
Force a reload of report formatters
47 48 49 |
# File 'lib/rescuetime/report_formatters.rb', line 47 def reload @formatters = load_formatters end |