Class: Lavin::User

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ User

Returns a new instance of User.



32
33
34
# File 'lib/lavin/user.rb', line 32

def initialize(**options)
  @user_index = options.delete(:user_index)
end

Instance Attribute Details

#user_indexObject (readonly)

Returns the value of attribute user_index.



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

def user_index
  @user_index
end

Class Method Details

.all_personasObject



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

def self.all_personas
  @all_personas ||= Set.new
end

.inherited(subclass) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/lavin/user.rb', line 12

def self.inherited(subclass)
  super
  subclass.include UserConfig
  subclass.include Worker
  subclass.include HttpClient
  subclass.include Failure
  subclass.include Success
  all_personas << subclass
end

.personasObject



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

def self.personas
  all_personas.select(&:enabled?)
end

Instance Method Details

#user_nameObject



36
37
38
# File 'lib/lavin/user.rb', line 36

def user_name
  "#{name}##{user_index}"
end