Class: ActionView::Digestor::Node
- Inherits:
-
Object
- Object
- ActionView::Digestor::Node
- Defined in:
- lib/action_view/digestor.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#logical_name ⇒ Object
readonly
Returns the value of attribute logical_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Class Method Summary collapse
Instance Method Summary collapse
- #dependency_digest(finder, stack) ⇒ Object
- #digest(finder, stack = []) ⇒ Object
-
#initialize(name, logical_name, template, children = []) ⇒ Node
constructor
A new instance of Node.
- #to_dep_map ⇒ Object
Constructor Details
#initialize(name, logical_name, template, children = []) ⇒ Node
Returns a new instance of Node.
90 91 92 93 94 95 |
# File 'lib/action_view/digestor.rb', line 90 def initialize(name, logical_name, template, children = []) @name = name @logical_name = logical_name @template = template @children = children end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
83 84 85 |
# File 'lib/action_view/digestor.rb', line 83 def children @children end |
#logical_name ⇒ Object (readonly)
Returns the value of attribute logical_name.
83 84 85 |
# File 'lib/action_view/digestor.rb', line 83 def logical_name @logical_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
83 84 85 |
# File 'lib/action_view/digestor.rb', line 83 def name @name end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
83 84 85 |
# File 'lib/action_view/digestor.rb', line 83 def template @template end |
Class Method Details
Instance Method Details
#dependency_digest(finder, stack) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/action_view/digestor.rb', line 101 def dependency_digest(finder, stack) children.map do |node| if stack.include?(node) false else finder.digest_cache[node.name] ||= begin stack.push node node.digest(finder, stack).tap { stack.pop } end end end.join("-") end |
#digest(finder, stack = []) ⇒ Object
97 98 99 |
# File 'lib/action_view/digestor.rb', line 97 def digest(finder, stack = []) ActiveSupport::Digest.hexdigest("#{template.source}-#{dependency_digest(finder, stack)}") end |
#to_dep_map ⇒ Object
114 115 116 |
# File 'lib/action_view/digestor.rb', line 114 def to_dep_map children.any? ? { name => children.map(&:to_dep_map) } : name end |