Class: Tache::Safe::Context

Inherits:
Context
  • Object
show all
Defined in:
lib/tache/safe.rb

Instance Attribute Summary

Attributes inherited from Context

#parent, #view

Instance Method Summary collapse

Methods inherited from Context

#[], #escape, #initialize, #partial

Constructor Details

This class inherits a constructor from Tache::Context

Instance Method Details

#push(view, &block) ⇒ Object



58
59
60
# File 'lib/tache/safe.rb', line 58

def push(view, &block)
  super tacheify(view), &block
end

#resolve(view, key) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/tache/safe.rb', line 62

def resolve(view, key)
  if view.respond_to?(:has_key?) && view.has_key?(key)
    value = view[key]
    return value if value == :missing 
    view.is_a?(Tache::Safe) && value.respond_to?(:call) ? value : tacheify(value)
  else
    :missing
  end
end