Class: Convection::Model::Template::Condition::ConditionalFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/convection/model/template/condition.rb

Instance Method Summary collapse

Constructor Details

#initialize(function_name, arg_array) ⇒ ConditionalFunction

Returns a new instance of ConditionalFunction



35
36
37
38
# File 'lib/convection/model/template/condition.rb', line 35

def initialize(function_name, arg_array)
  @function_name = function_name
  @function_arguments = arg_array
end

Instance Method Details

#renderObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/convection/model/template/condition.rb', line 40

def render
  rendered_values = []
  @function_arguments.each do |function_arg|
    if function_arg.respond_to? :render # the argument is another conditional function
      rendered_values << function_arg.render
    else
      rendered_values << function_arg
    end
  end

  { CONDITIONAL_FUNCTION_SYNTAX_MAP[@function_name] => rendered_values }
end