Method: CP::Option#merge

Defined in:
lib/cp/option.rb

#merge(opt) ⇒ Object



58
59
60
61
62
63
64
65
66
67
# File 'lib/cp/option.rb', line 58

def merge( opt )
  new_opt = self.dup
  new_opt.action = @action
  [:allowed, :default, :description, :type, :short, :long].each { |attr|
    val = opt.send( :"#{attr}" )
    new_opt.send( :"#{attr}=", val.dup ) unless val.nil?
  }

  new_opt
end