Class: Pakyow::Support::Pipeline::Action Private
- Inherits:
-
Object
- Object
- Pakyow::Support::Pipeline::Action
- 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 Attribute Summary collapse
- #name ⇒ Object readonly private
- #options ⇒ Object readonly private
- #target ⇒ Object readonly private
Instance Method Summary collapse
- #finalize(context = nil) ⇒ Object private
-
#initialize(target, *options, &block) ⇒ Action
constructor
private
A new instance of Action.
Constructor Details
#initialize(target, *options, &block) ⇒ Action
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 Action.
287 288 289 290 291 292 293 |
# File 'lib/pakyow/support/pipeline.rb', line 287 def initialize(target, *, &block) @target, @options, @block = target, , block if target.is_a?(Symbol) @name = target end end |
Instance Attribute Details
#name ⇒ 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.
285 286 287 |
# File 'lib/pakyow/support/pipeline.rb', line 285 def name @name end |
#options ⇒ 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.
285 286 287 |
# File 'lib/pakyow/support/pipeline.rb', line 285 def @options end |
#target ⇒ 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.
285 286 287 |
# File 'lib/pakyow/support/pipeline.rb', line 285 def target @target end |
Instance Method Details
#finalize(context = nil) ⇒ 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.
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/pakyow/support/pipeline.rb', line 295 def finalize(context = nil) if @block if context if @block.arity == 0 Proc.new do context.instance_exec(&@block) end else Proc.new do |object| context.instance_exec(object, &@block) end end else @block end elsif @target.is_a?(Symbol) && context.respond_to?(@target, true) && ([0].nil? || ![0].instance_methods(false).include?(:call)) if context context.method(@target) else raise "finalizing pipeline action #{@target} requires context" end else target, = if @target.is_a?(Symbol) [@options[0], @options[1..-1]] else [@target, @options] end instance = if target.is_a?(Class) target.new(*) else target end instance.method(:call) end end |