Sha256: ecb5372eee3be62ed55d5066b17ebcb20d34c0fb092ce3d8975db5d35793431c

Contents?: true

Size: 448 Bytes

Versions: 2

Compression:

Stored size: 448 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

2 entries across 2 versions & 1 rubygems

Version Path
del-0.1.18 lib/del/user.rb
del-0.1.17 lib/del/user.rb