Class: EventDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/event_decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ EventDecorator

Returns a new instance of EventDecorator.



2
3
4
# File 'lib/event_decorator.rb', line 2

def initialize(event)
  @event = event
end

Instance Method Details

#channelObject



6
7
8
# File 'lib/event_decorator.rb', line 6

def channel
  @event.channel
end

#channel_idObject



10
11
12
# File 'lib/event_decorator.rb', line 10

def channel_id
  @event.channel.id
end

#display_nameObject



14
15
16
# File 'lib/event_decorator.rb', line 14

def display_name
  user.display_name
end

#display_name_for(user_id) ⇒ Object



38
39
40
# File 'lib/event_decorator.rb', line 38

def display_name_for(user_id)
  find_user(user_id)&.display_name
end

#display_names_for(user_ids) ⇒ Object



42
43
44
# File 'lib/event_decorator.rb', line 42

def display_names_for(user_ids)
  find_users(user_ids).map(&:display_name)
end

#mentionObject



22
23
24
# File 'lib/event_decorator.rb', line 22

def mention
  user.mention
end

#mention_for(user_id) ⇒ Object



30
31
32
# File 'lib/event_decorator.rb', line 30

def mention_for(user_id)
  find_user(user_id)&.mention
end

#mentions_for(user_ids) ⇒ Object



34
35
36
# File 'lib/event_decorator.rb', line 34

def mentions_for(user_ids)
  find_users(user_ids).map(&:mention)
end

#user_idObject



18
19
20
# File 'lib/event_decorator.rb', line 18

def user_id
  user.id
end

#usersObject



26
27
28
# File 'lib/event_decorator.rb', line 26

def users
  server.users
end