Method: MatrixSdk::Room#initialize
- Defined in:
- lib/matrix_sdk/room.rb
#initialize(client, room_id, data = {}) ⇒ Room
Note:
This method isn’t supposed to be used directly, rather rooms should be retrieved from the Client abstraction.
Create a new room instance
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/matrix_sdk/room.rb', line 82 def initialize(client, room_id, data = {}) raise ArgumentError, 'Must be given a Client instance' unless client.is_a? Client room_id = MXID.new room_id unless room_id.is_a?(MXID) raise ArgumentError, 'room_id must be a valid Room ID' unless room_id.room_id? event_initialize @name = nil @topic = nil @canonical_alias = nil @aliases = [] @join_rule = nil @guest_access = nil @world_readable = nil @members = [] @events = [] @members_loaded = false @event_history_limit = 10 @avatar_url = nil @prev_batch = nil data.each do |k, v| instance_variable_set("@#{k}", v) if instance_variable_defined? "@#{k}" end @client = client @id = room_id.to_s @name_checked = Time.new(0) logger.debug "Created room #{room_id}" end |