Class: SagaForge::Dashboard::ContextPresenter
- Inherits:
-
Object
- Object
- SagaForge::Dashboard::ContextPresenter
- Defined in:
- app/presenters/saga_forge/dashboard/context_presenter.rb
Defined Under Namespace
Classes: Node
Constant Summary collapse
- LARGE_COLLECTION_THRESHOLD =
Above this many elements, a Hash/Array value isn't fully serialized just to build a 200-char preview; only its size is reported. Guards against a single giant context value (e.g. a batch job's collected results) doing an unbounded JSON serialization on every page load.
50
Instance Method Summary collapse
-
#initialize(state) ⇒ ContextPresenter
constructor
A new instance of ContextPresenter.
-
#saga_meta ⇒ Object
nil or the reserved sub-hash.
- #user_nodes ⇒ Object
Constructor Details
#initialize(state) ⇒ ContextPresenter
Returns a new instance of ContextPresenter.
12 13 14 |
# File 'app/presenters/saga_forge/dashboard/context_presenter.rb', line 12 def initialize(state) @context = state.context || {} end |
Instance Method Details
#saga_meta ⇒ Object
nil or the reserved sub-hash
20 |
# File 'app/presenters/saga_forge/dashboard/context_presenter.rb', line 20 def = @context["__saga_forge"] # nil or the reserved sub-hash |
#user_nodes ⇒ Object
16 17 18 |
# File 'app/presenters/saga_forge/dashboard/context_presenter.rb', line 16 def user_nodes @user_nodes ||= @context.except("__saga_forge").map { |k, v| node(k, v) } end |