Module: Musa::Series::Serie::WithSmartBlock

Included in:
Operations::Processor
Defined in:
lib/musa-dsl/series/base-series.rb

Overview

Mixin for series with SmartProcBinder-wrapped block attribute.

Similar to WithBlock but wraps procs in SmartProcBinder for flexible parameter binding.

Examples:

Usage

class SmartMapperSerie
  include Serie::Base
  include Serie::WithSmartBlock

  def initialize(&block)
    self.proc = block
    init
  end
end

See Also:

Instance Method Summary collapse

Instance Method Details

#procProc? #proc(&block) ⇒ Extension::SmartProcBinder::SmartProcBinder

Gets or sets the proc with SmartProcBinder wrapping.

Overloads:



1312
1313
1314
1315
1316
1317
1318
# File 'lib/musa-dsl/series/base-series.rb', line 1312

def proc(&block)
  if block
    @block = Extension::SmartProcBinder::SmartProcBinder.new(block)
  else
    @block&.proc
  end
end

#proc=(block) ⇒ Object

Sets the proc with SmartProcBinder wrapping.

Parameters:

  • block (Proc)

    block to wrap and store



1323
1324
1325
# File 'lib/musa-dsl/series/base-series.rb', line 1323

def proc=(block)
  @block = Extension::SmartProcBinder::SmartProcBinder.new(block)
end