Sha256: 869b783dc4cd1938761a485c4a121775e5d1ec8b315200f884d726fc31e7fa7e

Contents?: true

Size: 449 Bytes

Versions: 1

Compression:

Stored size: 449 Bytes

Contents

# frozen_string_literal: true

module Del
  # An XMPP user.
  class User
    attr_reader :jid, :attributes

    def initialize(jid, attributes)
      @jid = jid
      @attributes = attributes || {}
    end

    def mention_name
      attributes[:mention_name]
    end

    def to_s
      YAML.dump(attributes)
    end

    def self.map_from(attributes)
      return nil if attributes.nil?

      new(attributes['jid'], attributes)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
del-0.1.19 lib/del/user.rb