Class: TemplateInput

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Exportable
Defined in:
app/models/template_input.rb

Defined Under Namespace

Classes: FactInputResolver, InputResolver, PuppetParameterInputResolver, UnsatisfiedRequiredInput, UserInputResolver, ValueNotReady, VariableInputResolver

Constant Summary collapse

TYPES =
{ :user => N_('User input'), :fact => N_('Fact value'), :variable => N_('Variable'),
:puppet_parameter => N_('Puppet parameter') }.with_indifferent_access

Instance Method Summary collapse

Instance Method Details

#basic?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'app/models/template_input.rb', line 56

def basic?
  !advanced
end

#fact_template_input?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/models/template_input.rb', line 32

def fact_template_input?
  input_type == 'fact'
end

#options_arrayObject



52
53
54
# File 'app/models/template_input.rb', line 52

def options_array
  self.options.blank? ? [] : self.options.split(/\r?\n/).map(&:strip)
end

#preview(renderer) ⇒ Object



44
45
46
# File 'app/models/template_input.rb', line 44

def preview(renderer)
  get_resolver(renderer).preview
end

#puppet_parameter_template_input?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/template_input.rb', line 40

def puppet_parameter_template_input?
  input_type == 'puppet_parameter'
end

#user_template_input?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/models/template_input.rb', line 28

def user_template_input?
  input_type == 'user'
end

#value(renderer) ⇒ Object



48
49
50
# File 'app/models/template_input.rb', line 48

def value(renderer)
  get_resolver(renderer).value
end

#variable_template_input?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/template_input.rb', line 36

def variable_template_input?
  input_type == 'variable'
end