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
# File 'lib/convection/model/template/condition.rb', line 40

def render
  rendered_values = Array(@function_arguments).map do |function_arg|
    function_arg.respond_to?(:render) ? function_arg.render : function_arg
  end

  { CONDITIONAL_FUNCTION_SYNTAX_MAP[@function_name] => rendered_values }
end