Class: Riddler::UseCases::AdminPreviewStep
- Inherits:
-
Object
- Object
- Riddler::UseCases::AdminPreviewStep
- Defined in:
- lib/riddler/use_cases/admin_preview_step.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#preview_context_data ⇒ Object
readonly
Returns the value of attribute preview_context_data.
-
#step ⇒ Object
readonly
Returns the value of attribute step.
Instance Method Summary collapse
-
#initialize(definition, preview_context_data: {}) ⇒ AdminPreviewStep
constructor
A new instance of AdminPreviewStep.
- #process ⇒ Object
Constructor Details
#initialize(definition, preview_context_data: {}) ⇒ AdminPreviewStep
Returns a new instance of AdminPreviewStep.
6 7 8 9 10 11 |
# File 'lib/riddler/use_cases/admin_preview_step.rb', line 6 def initialize definition, preview_context_data: {} @definition = definition @preview_context_data = preview_context_data @context = ::Riddler::Context.new preview_context_data @step = ::Riddler::Step.for definition, context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/riddler/use_cases/admin_preview_step.rb', line 4 def context @context end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
4 5 6 |
# File 'lib/riddler/use_cases/admin_preview_step.rb', line 4 def definition @definition end |
#preview_context_data ⇒ Object (readonly)
Returns the value of attribute preview_context_data.
4 5 6 |
# File 'lib/riddler/use_cases/admin_preview_step.rb', line 4 def preview_context_data @preview_context_data end |
#step ⇒ Object (readonly)
Returns the value of attribute step.
4 5 6 |
# File 'lib/riddler/use_cases/admin_preview_step.rb', line 4 def step @step end |
Instance Method Details
#process ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/riddler/use_cases/admin_preview_step.rb', line 13 def process if step.include? hash = step.to_hash return hash unless hash.nil? { response_code: 204, message: "There was no step to include" } else { response_code: 204, include_predicate: step.include_predicate, message: "Excluded - the include_predicate returned false" } end end |