Class: Musa::Darwin::Darwin::MainContext Private

Inherits:
Object
  • Object
show all
Includes:
Extension::With
Defined in:
lib/musa-dsl/generative/darwin.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.

DSL context for Darwin configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ void

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.



211
212
213
214
# File 'lib/musa-dsl/generative/darwin.rb', line 211

def initialize(&block)
  @_weights = {}
  with &block
end

Instance Attribute Details

#_measuresProc, Hash (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.

Returns:

  • (Proc)

    measures evaluation block

  • (Hash)

    weight assignments



207
208
209
# File 'lib/musa-dsl/generative/darwin.rb', line 207

def _measures
  @_measures
end

#_weightsProc, Hash (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.

Returns:

  • (Proc)

    measures evaluation block

  • (Hash)

    weight assignments



207
208
209
# File 'lib/musa-dsl/generative/darwin.rb', line 207

def _weights
  @_weights
end

Instance Method Details

#measures {|object| ... } ⇒ Proc

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.

Defines measures evaluation block.

Yields:

  • (object)

    measures DSL block

Returns:

  • (Proc)

    the measures block



223
224
225
# File 'lib/musa-dsl/generative/darwin.rb', line 223

def measures(&block)
  @_measures = block
end

#weight(**feature_or_dimension_weights) ⇒ void

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.

This method returns an undefined value.

Assigns weights to features/dimensions.

Parameters:

  • feature_or_dimension_weights (Hash{Symbol => Numeric})

    name => weight pairs



234
235
236
237
238
# File 'lib/musa-dsl/generative/darwin.rb', line 234

def weight(**feature_or_dimension_weights)
  feature_or_dimension_weights.each do |name, value|
    @_weights[name] = value
  end
end

#with(*value_parameters, keep_block_context: nil, **key_parameters, &block) ⇒ Object Originally defined in module Extension::With

Note:

The _ parameter is special: when present, it signals "keep caller's context" and receives self (the object) as its value.

Note:

Uses SmartProcBinder internally to handle parameter matching.

Executes a block with flexible context and parameter handling.

Parameters:

  • value_parameters (Array)

    positional parameters to pass to block.

  • keep_block_context (Boolean, nil) (defaults to: nil)

    explicit control of context switching:

    • true: always keep caller's context
    • false: always use object's context
    • nil: auto-detect based on _ parameter
  • key_parameters (Hash)

    keyword parameters to pass to block.

  • block (Proc)

    block to execute.

Returns:

  • (Object)

    result of block execution.