class Mustache::Context

executed within. All Mustache tags reference keys in the Context.
A Context represents the context which a Mustache template is

def [](name)

Alias for `fetch`.
def [](name)
  fetch(name, nil)
end

def []=(name, value)

context[:name] = "Chris"

Can be used to add a value to the context in a hash-like way.
def []=(name, value)
  push(name => value)
end

def fetch(name, default = :__raise)

set to true), will raise a ContextMiss exception on miss.
If no second parameter is passed (or raise_on_context_miss is

second parameter.
stack. You may specify the default return value by passing a
Similar to Hash#fetch, finds a value by `name` in the context's
def fetch(name, default = :__raise)
  @stack.each do |frame|
    # Prevent infinite recursion.
    next if frame == self
    # Is this frame a hash?
    hash = frame.respond_to?(:has_key?)
    if hash && frame.has_key?(name)
      return frame[name]
    elsif hash && frame.has_key?(name.to_s)
      return frame[name.to_s]
    elsif !hash && frame.respond_to?(name)
      return frame.__send__(name)
    end
  end
  if default == :__raise || mustache_in_stack.raise_on_context_miss?
    raise ContextMiss.new("Can't find #{name} in #{@stack.inspect}")
  else
    default
  end
end

def has_key?(key)

`context[key]` give us a result that was set. Basically.
Do we know about a particular key? In other words, will calling
def has_key?(key)
  !!fetch(key)
rescue ContextMiss
  false
end

def initialize(mustache)

Expect to be passed an instance of `Mustache`.
def initialize(mustache)
  @stack = [mustache]
end

def mustache_in_stack

inside a Mustache object as a context, we'll use that one.
Find the first Mustache in the stack. If we're being rendered
def mustache_in_stack
  @stack.detect { |frame| frame.is_a?(Mustache) }
end

def partial(name)

to `partial`, we call it and render the result.
representing your profile page or some other template) responds
If the Mustache view handling the rendering (e.g. the view

`partial` method, which would be this sucker right here.
A {{>partial}} tag translates into a call to the context's
def partial(name)
  # Look for the first Mustache in the stack.
  mustache = mustache_in_stack
  # Call its `partial` method and render the result.
  mustache.render(mustache.partial(name), self)
end

def pop

Returns the Context.

internal stack.
Removes the most recently added object from the context's
def pop
  @stack.shift
  self
end

def push(new)

Returns the Context.

Adds a new object to the context's internal stack.
def push(new)
  @stack.unshift(new)
  self
end