Class: ActiveWorker::Template
- Inherits:
-
Object
- Object
- ActiveWorker::Template
- Includes:
- Mongoid::Document
- Defined in:
- lib/active_worker/template.rb
Instance Method Summary collapse
Instance Method Details
#build_configuration ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/active_worker/template.rb', line 20 def build_configuration configuration = configuration_class.new configuration_class.template_fields.each do |field| configuration.write_attribute(field,read_attribute(field)) end configuration.template_name = name child_template_ids.each do |child_id| child = Template.find(child_id) configuration.configurations << child.build_configuration end configuration end |
#configuration_class ⇒ Object
37 38 39 |
# File 'lib/active_worker/template.rb', line 37 def configuration_class configuration_type.constantize end |
#name_for_display ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/active_worker/template.rb', line 12 def name_for_display if(name && !(name.empty?)) name else configuration_type.split("::")[0..-2].join(" ") end end |