class SimpleTemplates::AST::Placeholder

A Placeholder specialized Node that implements the render method for placeholders

Public Instance Methods

render(substitutions) click to toggle source

Renders the substitutions in the input. Raises an error if it is not allowed. (see allowed?) @param substitutions [Hash{ Symbol => String }] @return [String] the content of the placeholder

# File lib/simple_templates/AST/placeholder.rb, line 16
def render(substitutions)
  if allowed?
    substitutions.fetch(contents.to_sym)
  else
    raise 'Unable to render invalid placeholder!'
  end
end