class Pakyow::Support::Pipeline::Internal
@api private
Attributes
actions[R]
Public Class Methods
new(&block)
click to toggle source
# File lib/pakyow/support/pipeline.rb, line 186 def initialize(&block) @actions = [] if block_given? instance_exec(&block) end end
Public Instance Methods
action(target, *options, before: nil, after: nil, &block)
click to toggle source
# File lib/pakyow/support/pipeline.rb, line 203 def action(target, *options, before: nil, after: nil, &block) Action.new(target, *options, &block).tap do |action| if before if i = @actions.index { |a| a.name == before } @actions.insert(i, action) else @actions.unshift(action) end elsif after if i = @actions.index { |a| a.name == after } @actions.insert(i + 1, action) else @actions << action end else @actions << action end end end
callable(context)
click to toggle source
# File lib/pakyow/support/pipeline.rb, line 199 def callable(context) Callable.new(@actions, context) end
exclude_actions(actions)
click to toggle source
# File lib/pakyow/support/pipeline.rb, line 233 def exclude_actions(actions) # Map input into a common denominator, to exclude both names and other action objects. targets = actions.map { |action| if action.is_a?(Action) action.target else action end } @actions.delete_if { |action| targets.include?(action.target) } end
include_actions(actions)
click to toggle source
# File lib/pakyow/support/pipeline.rb, line 229 def include_actions(actions) @actions.concat(actions).uniq! end
initialize_copy(_)
click to toggle source
Calls superclass method
# File lib/pakyow/support/pipeline.rb, line 194 def initialize_copy(_) @actions = @actions.dup super end
skip(*actions)
click to toggle source
# File lib/pakyow/support/pipeline.rb, line 223 def skip(*actions) @actions.delete_if { |action| actions.include?(action.name) } end