Module: Dossier::Model
- Included in:
- MultiReport, Report
- Defined in:
- lib/dossier/model.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
- .anonymous_report ⇒ Object
- .class_to_name(klass) ⇒ Object
-
.included(base) ⇒ Object
not using ActiveSupport::Concern because ClassMethods must be extended after ActiveModel::Naming.
- .name_to_class(name) ⇒ Object
Instance Method Summary collapse
Class Method Details
.anonymous_report ⇒ Object
19 20 21 |
# File 'lib/dossier/model.rb', line 19 def self.anonymous_report 'AnonymousReport' end |
.class_to_name(klass) ⇒ Object
11 12 13 |
# File 'lib/dossier/model.rb', line 11 def self.class_to_name(klass) (klass.name || anonymous_report).underscore[0..-8] end |
.included(base) ⇒ Object
not using ActiveSupport::Concern because ClassMethods must be extended after ActiveModel::Naming
6 7 8 9 |
# File 'lib/dossier/model.rb', line 6 def self.included(base) base.extend ActiveModel::Naming base.extend ClassMethods end |
.name_to_class(name) ⇒ Object
15 16 17 |
# File 'lib/dossier/model.rb', line 15 def self.name_to_class(name) "#{name}_report".classify.constantize end |
Instance Method Details
#persisted? ⇒ Boolean
35 36 37 |
# File 'lib/dossier/model.rb', line 35 def persisted? true end |
#to_key ⇒ Object
23 24 25 |
# File 'lib/dossier/model.rb', line 23 def to_key [report_name] end |
#to_model ⇒ Object
31 32 33 |
# File 'lib/dossier/model.rb', line 31 def to_model self end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/dossier/model.rb', line 27 def to_s report_name end |