class Macros4Cuke::UnaryElement

Base class used internally by the template engine. The generalization of any element from a template that has one variable whose actual value influences the rendition.

Attributes

name[R]

The name of the placeholder/variable.

Public Class Methods

new(aVarName) click to toggle source

@param aVarName [String] The name of the placeholder from a template.

# File lib/macros4cuke/templating/unary-element.rb, line 16
def initialize(aVarName)
  @name = aVarName
end

Protected Instance Methods

retrieve_value_from(aContextObject, theLocals) click to toggle source

This method has the same signature as the {Engine#render} method. @return [Object] The actual value from the locals or context that is assigned to the variable.

# File lib/macros4cuke/templating/unary-element.rb, line 25
def retrieve_value_from(aContextObject, theLocals)
  actual_value = theLocals[name]
  if actual_value.nil? && aContextObject.respond_to?(name.to_sym)
    actual_value = aContextObject.send(name.to_sym)
  end

  return actual_value
end