Module: Origen::CommandHelpers

Defined in:
lib/origen/commands/helpers.rb

Class Method Summary collapse

Class Method Details

.extend_options(opts, app_opts, options) ⇒ Object


3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/origen/commands/helpers.rb', line 3

def self.extend_options(opts, app_opts, options)
  app_opts.each do |app_option|
    if app_option.last.is_a?(Proc)
      ao_proc = app_option.pop
      if ao_proc.arity == 1
        opts.on(*app_option) { ao_proc.call(options) }
      else
        opts.on(*app_option) { |arg| ao_proc.call(options, arg) }
      end
    else
      opts.on(*app_option) {}
    end
  end
end