Class Sip::CmdOpts
In: lib/sip/cmdopts.rb
Parent: Hash

Methods

set   to_s  

Public Instance methods

[Source]

# File lib/sip/cmdopts.rb, line 3
    def set(*k)
      k.each { |key|
        self[key] = nil
      }
    end

[Source]

# File lib/sip/cmdopts.rb, line 9
    def to_s(prefix=nil, suffix=nil)
      opts = map { |k,v| 
        if v.nil?
          (k.length > 1) ? "--#{k}" : "-#{k}"
        else
          (k.length > 1) ? "--#{k}=#{v}" : "-#{k} #{v}" 
        end
      }.join(" ")
      [(prefix.nil? ? "" : prefix), opts, (suffix.nil? ? "" : suffix)].select { |v| v != "" }.join(" ")
    end

[Validate]