Method: Origen::Application::Target#loop

Defined in:
lib/origen/application/target.rb

#loop(options = {}) ⇒ Object

Implement a target loop based on the supplied options. The options can contain the keys :target or :targets or neither.

In the neither case the loop will run once for the current workspace default target.

In the case where one of the keys is present the loop will run for each target and the options will be passed into the block with the key :target set to the current target.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/origen/application/target.rb', line 34

def loop(options = {})
  options = {
    set_target:  true,
    force_debug: false # Set true to force debug mode for all targets
  }.merge(options)
  targets = [options.delete(:target), options.delete(:targets)].flatten.compact.uniq
  targets = [file!.basename.to_s] if targets.empty?
  set = options.delete(:set_target)
  targets.each do |target|
    Origen.load_target(target, options) if set
    options[:target] = target
    yield options
  end
end