Class: ForemanTemplates::ExportResult

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_templates/export_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, exported = true) ⇒ ExportResult

Returns a new instance of ExportResult.



5
6
7
8
9
10
# File 'app/services/foreman_templates/export_result.rb', line 5

def initialize(template, exported = true)
  @template = template
  @exported = exported
  @name = template.name
  @template_file = template.template_file
end

Instance Attribute Details

#additional_infoObject (readonly)

Returns the value of attribute additional_info.



3
4
5
# File 'app/services/foreman_templates/export_result.rb', line 3

def additional_info
  @additional_info
end

#exportedObject (readonly)

Returns the value of attribute exported.



3
4
5
# File 'app/services/foreman_templates/export_result.rb', line 3

def exported
  @exported
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'app/services/foreman_templates/export_result.rb', line 3

def name
  @name
end

#templateObject (readonly)

Returns the value of attribute template.



3
4
5
# File 'app/services/foreman_templates/export_result.rb', line 3

def template
  @template
end

#template_fileObject (readonly)

Returns the value of attribute template_file.



3
4
5
# File 'app/services/foreman_templates/export_result.rb', line 3

def template_file
  @template_file
end

Instance Method Details

#generic_info(additional_msg) ⇒ Object



26
27
28
29
30
31
# File 'app/services/foreman_templates/export_result.rb', line 26

def generic_info(additional_msg)
  @exported = false
  @additional_info = additional_msg
  Logging.logger('app').debug "Not exporting #{@template.name}: #{additional_msg}"
  self
end

#matching_filterObject



22
23
24
# File 'app/services/foreman_templates/export_result.rb', line 22

def matching_filter
  generic_info "Skipping, 'name' filtered out based on 'filter' and 'negate' settings"
end

#to_hObject



12
13
14
15
16
17
18
19
20
# File 'app/services/foreman_templates/export_result.rb', line 12

def to_h
  {
    :id => template.id,
    :name => @name,
    :exported => @exported,
    :type => template.class.name.underscore,
    :additional_info => @additional_info
  }
end