Class: User

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/campfire/polling_bot/plugins/shared/user.rb

Instance Method Summary collapse

Instance Method Details

#short_nameObject


9
10
11
# File 'lib/campfire/polling_bot/plugins/shared/user.rb', line 9

def short_name
  name && name.split(' ').first
end

#wants_greeting=(yesno) ⇒ Object


23
24
25
26
27
28
29
30
31
# File 'lib/campfire/polling_bot/plugins/shared/user.rb', line 23

def wants_greeting=(yesno)
  greeting_setting = GreetingSetting.for_user(self)

  if greeting_setting
    greeting_setting.update(:wants_greeting => yesno)
  else
    GreetingSetting.create(:user => self, :wants_greeting => yesno)
  end
end

#wants_greeting?Boolean

Returns:

  • (Boolean)

13
14
15
16
17
18
19
20
21
# File 'lib/campfire/polling_bot/plugins/shared/user.rb', line 13

def wants_greeting?
  greeting_setting = GreetingSetting.for_user(self)

  if greeting_setting
    greeting_setting.wants_greeting
  else
    true
  end
end