Class: User

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ User



10
11
12
13
14
15
# File 'lib/auth_client/user.rb', line 10

def initialize(options)
  options.each_pair do |key, val|
    self.class_eval("def #{key}; @#{key}; end")
    self.instance_variable_set "@#{key}", val
  end
end

Class Method Details

.find_by(id: nil) ⇒ Object



4
5
6
7
8
# File 'lib/auth_client/user.rb', line 4

def self.find_by(id: nil)
  return nil unless id

  new RedisUserConnector.get(id).merge('id' => id)
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/auth_client/user.rb', line 17

def to_s
  [surname, name, patronymic].compact.join(' ')
end