Class: Woody::Decorators::CreatorUser
- Inherits:
-
User
- Object
- Base
- User
- Woody::Decorators::CreatorUser
show all
- Defined in:
- lib/woody/decorators/creator_user.rb
Instance Method Summary
collapse
Methods inherited from User
#exist?, #first_name, #full_name, #id, #initialize, #last_name, #short_name
Methods inherited from Base
#initialize, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Woody::Decorators::Base
Instance Method Details
#avatar ⇒ Object
6
7
8
|
# File 'lib/woody/decorators/creator_user.rb', line 6
def avatar
super('creator')
end
|
#location ⇒ Object
10
11
12
|
# File 'lib/woody/decorators/creator_user.rb', line 10
def location
@model.location.capitalize
end
|
#portfolio ⇒ Object
21
22
23
24
25
|
# File 'lib/woody/decorators/creator_user.rb', line 21
def portfolio
parsed_url = URI.parse(@model.portfolio)
parsed_url.scheme ? @model.portfolio
: format('http://%s', @model.portfolio)
end
|
#short_portfolio ⇒ Object
27
28
29
30
31
|
# File 'lib/woody/decorators/creator_user.rb', line 27
def short_portfolio
parsed_url = URI.parse(@model.portfolio)
return parsed_url.host.downcase if parsed_url.host
truncate(parsed_url.path.split('/').first, 17)
end
|
#valid_portfolio_url? ⇒ Boolean
14
15
16
17
18
19
|
# File 'lib/woody/decorators/creator_user.rb', line 14
def valid_portfolio_url?
URI.parse(@model.portfolio)
true
rescue URI::InvalidURIError
false
end
|