Class: ActiveWorker::Template

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document
Defined in:
lib/active_worker/template.rb

Instance Method Summary collapse

Instance Method Details

#build_configurationObject



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_classObject



37
38
39
# File 'lib/active_worker/template.rb', line 37

def configuration_class
  configuration_type.constantize
end

#name_for_displayObject



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