Class: Vizcore::DSL::MidiMapExecutor::ActionContext Private
- Inherits:
-
Object
- Object
- Vizcore::DSL::MidiMapExecutor::ActionContext
- Defined in:
- lib/vizcore/dsl/midi_map_executor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Runtime DSL context used while executing one ‘midi_map` action block.
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
private
Collected runtime actions emitted by DSL calls.
Instance Method Summary collapse
-
#initialize(scenes:, globals:) ⇒ ActionContext
constructor
private
A new instance of ActionContext.
- #set(key, value) ⇒ void private
- #switch_scene(name, effect: nil) ⇒ void private
Constructor Details
#initialize(scenes:, globals:) ⇒ ActionContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ActionContext.
135 136 137 138 139 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 135 def initialize(scenes:, globals:) @scenes = scenes @globals = globals @actions = [] end |
Instance Attribute Details
#actions ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Collected runtime actions emitted by DSL calls.
131 132 133 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 131 def actions @actions end |
Instance Method Details
#set(key, value) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
161 162 163 164 165 166 167 168 169 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 161 def set(key, value) symbol_key = key.to_sym @globals[symbol_key] = value @actions << { type: :set_global, key: symbol_key, value: value } end |
#switch_scene(name, effect: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 144 def switch_scene(name, effect: nil) scene = @scenes[name.to_sym] return unless scene @actions << { type: :switch_scene, scene: { name: scene[:name], layers: scene[:layers].map { |layer| deep_dup(layer) } }, effect: deep_dup(effect) } end |