Class: Musa::Variatio::Variatio::B Private
- Defined in:
- lib/musa-dsl/generative/variatio.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.
Internal tree node for attribute application phase.
Manages execution of with_attributes blocks during variation generation.
Coordinates attribute application across field hierarchy.
Instance Attribute Summary collapse
- #affected_field_names ⇒ Object readonly private
- #blocks ⇒ Object readonly private
- #inner ⇒ Object readonly private
- #options ⇒ Object readonly private
- #parameter_name ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(parameter_name, options, affected_field_names, inner, blocks) ⇒ B
constructor
private
A new instance of B.
- #inspect ⇒ Object (also: #to_s) private
- #run(parameters_with_depth, parent_parameters = nil) ⇒ Object private
Constructor Details
#initialize(parameter_name, options, affected_field_names, inner, blocks) ⇒ B
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 B.
386 387 388 389 390 391 392 393 |
# File 'lib/musa-dsl/generative/variatio.rb', line 386 def initialize(parameter_name, , affected_field_names, inner, blocks) @parameter_name = parameter_name @options = @affected_field_names = affected_field_names @inner = inner @procedures = blocks.collect { |proc| Musa::Extension::SmartProcBinder::SmartProcBinder.new proc } end |
Instance Attribute Details
#affected_field_names ⇒ 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.
384 385 386 |
# File 'lib/musa-dsl/generative/variatio.rb', line 384 def affected_field_names @affected_field_names end |
#blocks ⇒ 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.
384 385 386 |
# File 'lib/musa-dsl/generative/variatio.rb', line 384 def blocks @blocks end |
#inner ⇒ 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.
384 385 386 |
# File 'lib/musa-dsl/generative/variatio.rb', line 384 def inner @inner 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.
384 385 386 |
# File 'lib/musa-dsl/generative/variatio.rb', line 384 def @options end |
#parameter_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.
384 385 386 |
# File 'lib/musa-dsl/generative/variatio.rb', line 384 def parameter_name @parameter_name end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
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.
420 421 422 |
# File 'lib/musa-dsl/generative/variatio.rb', line 420 def inspect "B name: #{@parameter_name}, options: #{@options}, affected_field_names: #{@affected_field_names}, blocks_size: #{@blocks.size}, inner: #{@inner}" end |
#run(parameters_with_depth, parent_parameters = 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.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/musa-dsl/generative/variatio.rb', line 395 def run(parameters_with_depth, parent_parameters = nil) parent_parameters ||= {} @options.each do |option| base = @parameter_name == :_maincontext ? parameters_with_depth : parameters_with_depth[@parameter_name][option] parameters = base.select { |k, _v| @affected_field_names.include? k }.merge(parent_parameters) parameters[@parameter_name] = option @procedures.each do |procedure_binder| procedure_binder.call **parameters end if @parameter_name == :_maincontext @inner.each do |inner| inner.run parameters_with_depth, parameters end else @inner.each do |inner| inner.run parameters_with_depth[@parameter_name][option], parameters end end end end |