Class: ViewModel::TraversalContext::SharedContext
- Inherits:
-
Object
- Object
- ViewModel::TraversalContext::SharedContext
- Defined in:
- lib/view_model/traversal_context.rb
Direct Known Subclasses
DeserializeContext::SharedContext, SerializeContext::SharedContext
Instance Attribute Summary collapse
-
#access_control ⇒ Object
readonly
Returns the value of attribute access_control.
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
Instance Method Summary collapse
-
#initialize(access_control: ViewModel::AccessControl::Open.new, callbacks: []) ⇒ SharedContext
constructor
A new instance of SharedContext.
Constructor Details
#initialize(access_control: ViewModel::AccessControl::Open.new, callbacks: []) ⇒ SharedContext
Returns a new instance of SharedContext.
10 11 12 13 14 15 16 |
# File 'lib/view_model/traversal_context.rb', line 10 def initialize(access_control: ViewModel::AccessControl::Open.new, callbacks: []) @access_control = access_control # Access control is guaranteed to be run after callbacks that may have # side-effects on the view. pre_callbacks, post_callbacks = callbacks.partition { |c| c.class.updates_view? } @callbacks = pre_callbacks + [access_control] + post_callbacks end |
Instance Attribute Details
#access_control ⇒ Object (readonly)
Returns the value of attribute access_control.
8 9 10 |
# File 'lib/view_model/traversal_context.rb', line 8 def access_control @access_control end |
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
8 9 10 |
# File 'lib/view_model/traversal_context.rb', line 8 def callbacks @callbacks end |