Class: Pakyow::Support::Pipeline::Callable Private
- Inherits:
-
Object
- Object
- Pakyow::Support::Pipeline::Callable
- Defined in:
- lib/pakyow/support/pipeline.rb
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.
Instance Method Summary collapse
- #call(object, stack = @stack.dup) ⇒ Object private
-
#initialize(actions, context) ⇒ Callable
constructor
private
A new instance of Callable.
- #initialize_copy(_) ⇒ Object private
Constructor Details
#initialize(actions, context) ⇒ Callable
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 Callable.
251 252 253 254 255 |
# File 'lib/pakyow/support/pipeline.rb', line 251 def initialize(actions, context) @stack = actions.map { |action| action.finalize(context) } end |
Instance Method Details
#call(object, stack = @stack.dup) ⇒ Object
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.
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/pakyow/support/pipeline.rb', line 263 def call(object, stack = @stack.dup) catch :halt do until stack.empty? || object.halted? action = stack.shift if action.arity == 0 action.call do call(object, stack) end else action.call(object) do call(object, stack) end end end end object.pipelined end |
#initialize_copy(_) ⇒ Object
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.
257 258 259 260 261 |
# File 'lib/pakyow/support/pipeline.rb', line 257 def initialize_copy(_) @stack = @stack.dup super end |