Sha256: 0ec5e7f8006338377317ff3dde00fc8a68c3ee0825d4a14f2e9f44b5da63e67d

Contents?: true

Size: 930 Bytes

Versions: 4

Compression:

Stored size: 930 Bytes

Contents

module OverSIP::SIP

  class NameAddr < OverSIP::SIP::Uri

    attr_reader :display_name

    def initialize display_name=nil, scheme=:sip, user=nil, host=nil, port=nil
      @display_name = display_name
      @scheme = scheme.to_sym
      @user = user
      @host = host
      @host_type = ::OverSIP::Utils.ip_type(host) || :domain  if host
      @port = port

      @name_addr_modified = true
      @uri_modified = true
    end

    def display_name= value
      @display_name = value
      @name_addr_modified = true
    end

    def to_s
      return @name_addr  if @name_addr and not @name_addr_modified and not @uri_modified

      @name_addr = ""
      ( @name_addr << '"' << @display_name << '" ' )  if @display_name
      @name_addr << "<" << uri << ">"

      @name_addr_modified = false
      @name_addr

    end
    alias :inspect :to_s

    def modified?
      @uri_modified or @name_addr_modified
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oversip-1.3.8 lib/oversip/sip/name_addr.rb
oversip-1.3.7 lib/oversip/sip/name_addr.rb
oversip-1.3.6 lib/oversip/sip/name_addr.rb
oversip-1.3.5 lib/oversip/sip/name_addr.rb