Class: Synthra::Behaviors::Registry::BlockBehavior Private

Inherits:
Object
  • Object
show all
Defined in:
lib/synthra/behaviors/registry.rb

Overview

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.

Wrapper for block-based behaviors

Allows blocks to be used as behaviors. The wrapper creates BlockBehaviorInstance objects when instantiated.

Instance Method Summary collapse

Constructor Details

#initialize {|context, result, value| ... } ⇒ BlockBehavior

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.

Create a new block behavior wrapper

Yields:

  • (context, result, value)

    block for applying behavior



183
184
185
# File 'lib/synthra/behaviors/registry.rb', line 183

def initialize(&block)
  @block = block
end

Instance Method Details

#new(value, rng = nil) ⇒ BlockBehaviorInstance

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.

Create a new instance of this block behavior

Parameters:

  • value (Object)

    behavior configuration

  • rng (Generator::RNG, nil) (defaults to: nil)

    random number generator

Returns:



195
196
197
# File 'lib/synthra/behaviors/registry.rb', line 195

def new(value, rng = nil)
  BlockBehaviorInstance.new(value, rng, @block)
end