| Class | TemplatePage::Context |
| In: |
template.rb
|
| Parent: | Object |
A context holds a stack of key/value pairs (like a symbol table). When asked to resolve a key, it first searches the top of the stack, then the next level, and so on until it finds a match (or runs out of entries)
Find a scalar value, throwing an exception if not found. This method is used when substituting the %xxx% constructs
# File template.rb, line 62
62: def find_scalar(key)
63: @stack.reverse_each do |level|
64: if val = level[key]
65: return val unless val.kind_of? Array
66: end
67: end
68: raise "Template error: can't find variable '#{key}'"
69: end