Class: Commands::Init::UserModel
Instance Attribute Summary collapse
Class Method Summary
collapse
-
.abstract ⇒ Object
Internal implementation - don’t mess with this ========================================================================.
Instance Method Summary
collapse
Methods inherited from InitModel
inheritable_attributes, inherited, #rank, run
Constructor Details
Returns a new instance of UserModel.
28
29
30
31
32
33
34
|
# File 'lib/commands/init/user_model.rb', line 28
def initialize
@login = self.class.login
@full_name = self.class.full_name
@password = self.class.password
@email = self.class.email
@super = self.class.super
end
|
Instance Attribute Details
#login ⇒ Object
Returns the value of attribute login.
26
27
28
|
# File 'lib/commands/init/user_model.rb', line 26
def login
@login
end
|
#password ⇒ Object
Returns the value of attribute password.
26
27
28
|
# File 'lib/commands/init/user_model.rb', line 26
def password
@password
end
|
Class Method Details
.abstract ⇒ Object
Internal implementation - don’t mess with this
22
23
24
|
# File 'lib/commands/init/user_model.rb', line 22
def self.abstract
true
end
|
Instance Method Details
#email ⇒ Object
36
37
38
|
# File 'lib/commands/init/user_model.rb', line 36
def email
@email || "#{login}@example.com"
end
|
#execute(p4, models = nil, super_user = nil) ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/commands/init/user_model.rb', line 61
def execute(p4, models=nil, super_user=nil)
p4.save_user(to_spec, '-f')
p4.user = login
p4.password = ''
p4.run_password('', password) if password
if super_user
p4.user = super_user.login
p4.password = super_user.password
end
end
|
#full_name ⇒ Object
40
41
42
|
# File 'lib/commands/init/user_model.rb', line 40
def full_name
@full_name || login
end
|
#super? ⇒ Boolean
44
45
46
|
# File 'lib/commands/init/user_model.rb', line 44
def super?
@super
end
|
#to_s ⇒ Object
48
49
50
|
# File 'lib/commands/init/user_model.rb', line 48
def to_s
"UserModel: login=#{login} email=#{email} full_name=#{full_name} password=#{password}"
end
|
#to_spec ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/commands/init/user_model.rb', line 52
def to_spec
spec = {
'User' => login,
'Email' => email,
'FullName' => full_name
}
spec
end
|