Module: Musa::Series::Serie::WithBlock

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

Overview

Mixin for series with block/proc attribute (simple version).

Provides proc accessor for series that use a Proc directly without SmartProcBinder wrapping.

Examples:

Usage

class MapperSerie
  include Serie::Base
  include Serie::WithBlock

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

See Also:

Instance Method Summary collapse

Instance Method Details

#procProc? #proc(&block) ⇒ Proc

Gets or sets the proc.

Overloads:

  • #procProc?

    Returns the stored proc.

    Returns:

    • (Proc, nil)

      the stored proc

  • #proc(&block) ⇒ Proc

    Returns the stored block.

    Parameters:

    • block (Proc)

      block to store

    Returns:

    • (Proc)

      the stored block



1274
1275
1276
# File 'lib/musa-dsl/series/base-series.rb', line 1274

def proc(&block)
  block ? (@block = block) : @block
end

#proc=(block) ⇒ Object

Sets the proc directly.

Parameters:

  • block (Proc)

    block to store



1281
1282
1283
# File 'lib/musa-dsl/series/base-series.rb', line 1281

def proc=(block)
  @block = block
end