Class: User
- Inherits:
-
Object
- Object
- User
- Defined in:
- app/models/user.rb
Constant Summary collapse
- EMAIL_NAME_REGEX =
'[\w\.%\+\-]+'.freeze
- DOMAIN_HEAD_REGEX =
'(?:[A-Z0-9\-]+\.)+'.freeze
- DOMAIN_TLD_REGEX =
'(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)'.freeze
- EMAIL_REGEX =
/\A#{EMAIL_NAME_REGEX}@#{DOMAIN_HEAD_REGEX}#{DOMAIN_TLD_REGEX}\z/i
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Profile.
-
#last_name ⇒ Object
Profile.
-
#name ⇒ Object
Returns the value of attribute name.
- #state ⇒ Object
Class Method Summary collapse
Instance Method Summary collapse
- #activate ⇒ Object
- #active? ⇒ Boolean
- #dom_id ⇒ Object
- #inactivate ⇒ Object
- #inactive? ⇒ Boolean
- #slug ⇒ Object
-
#to_param ⇒ Object
Other.
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
21 22 23 |
# File 'app/models/user.rb', line 21 def email @email end |
#first_name ⇒ Object
Profile
74 75 76 |
# File 'app/models/user.rb', line 74 def first_name @first_name end |
#last_name ⇒ Object
Profile
74 75 76 |
# File 'app/models/user.rb', line 74 def last_name @last_name end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'app/models/user.rb', line 7 def name @name end |
#state ⇒ Object
50 |
# File 'app/models/user.rb', line 50 def state; @state ||= 'inactive' end |
Class Method Details
.[](name) ⇒ Object
85 86 87 |
# File 'app/models/user.rb', line 85 def [] name by_name name.to_s end |
.avatar_url(user_name) ⇒ Object
91 92 93 |
# File 'app/models/user.rb', line 91 def avatar_url user_name "#{rad.users.avatars_path}/avatars/#{user_name}.icon" end |
Instance Method Details
#activate ⇒ Object
51 |
# File 'app/models/user.rb', line 51 def activate; self.state = 'active' end |
#active? ⇒ Boolean
52 |
# File 'app/models/user.rb', line 52 def active?; state == 'active' end |
#dom_id ⇒ Object
102 |
# File 'app/models/user.rb', line 102 def dom_id; "user: #{super}" end |
#inactivate ⇒ Object
53 |
# File 'app/models/user.rb', line 53 def inactivate; self.state = 'inactive' end |
#inactive? ⇒ Boolean
54 |
# File 'app/models/user.rb', line 54 def inactive?; state == 'inactive' end |
#slug ⇒ Object
104 |
# File 'app/models/user.rb', line 104 def slug; name end |
#to_param ⇒ Object
Other
100 |
# File 'app/models/user.rb', line 100 def to_param; name end |