Class: Utopia::Content::Node::Context
- Inherits:
-
Struct
- Object
- Struct
- Utopia::Content::Node::Context
- Defined in:
- lib/utopia/content/node.rb
Overview
This is a special context in which a limited set of well defined methods are exposed in the content view.
Instance Attribute Summary collapse
-
#state ⇒ Object
(also: #current)
Returns the value of attribute state.
-
#transaction ⇒ Object
Returns the value of attribute transaction.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #attributes ⇒ Object
- #content ⇒ Object
- #controller ⇒ Object
- #first ⇒ Object
- #links(*arguments, &block) ⇒ Object
- #localization ⇒ Object
- #parent ⇒ Object
- #partial(*args, &block) ⇒ Object (also: #deferred_tag)
- #request ⇒ Object
- #response ⇒ Object
Instance Attribute Details
#state ⇒ Object Also known as: current
Returns the value of attribute state
131 132 133 |
# File 'lib/utopia/content/node.rb', line 131 def state @state end |
#transaction ⇒ Object
Returns the value of attribute transaction
131 132 133 |
# File 'lib/utopia/content/node.rb', line 131 def transaction @transaction end |
Instance Method Details
#[](key) ⇒ Object
164 165 166 |
# File 'lib/utopia/content/node.rb', line 164 def [] key state.attributes.fetch(key) {transaction.attributes[key]} end |
#attributes ⇒ Object
160 161 162 |
# File 'lib/utopia/content/node.rb', line 160 def attributes state.attributes end |
#content ⇒ Object
170 171 172 |
# File 'lib/utopia/content/node.rb', line 170 def content transaction.content end |
#controller ⇒ Object
144 145 146 |
# File 'lib/utopia/content/node.rb', line 144 def controller transaction.controller end |
#first ⇒ Object
178 179 180 |
# File 'lib/utopia/content/node.rb', line 178 def first transaction.first end |
#links(*arguments, &block) ⇒ Object
182 183 184 |
# File 'lib/utopia/content/node.rb', line 182 def links(*arguments, &block) state.node.links(*arguments, &block) end |
#localization ⇒ Object
148 149 150 |
# File 'lib/utopia/content/node.rb', line 148 def localization transaction.localization end |
#parent ⇒ Object
174 175 176 |
# File 'lib/utopia/content/node.rb', line 174 def parent transaction.parent end |
#partial(*args, &block) ⇒ Object Also known as: deferred_tag
132 133 134 135 136 137 138 139 140 |
# File 'lib/utopia/content/node.rb', line 132 def partial(*args, &block) if block_given? state.defer(&block) else state.defer do |transaction| transaction.tag(*args) end end end |
#request ⇒ Object
152 153 154 |
# File 'lib/utopia/content/node.rb', line 152 def request transaction.request end |
#response ⇒ Object
156 157 158 |
# File 'lib/utopia/content/node.rb', line 156 def response transaction end |