Class: Rst::UserPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/rst/user_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ UserPresenter

Returns a new instance of UserPresenter.



3
4
5
# File 'lib/rst/user_presenter.rb', line 3

def initialize(user)
  @user = user
end

Instance Method Details

#descriptionObject



19
20
21
22
23
24
25
# File 'lib/rst/user_presenter.rb', line 19

def description
  if @user.description == ""
    "No bio"
  else
    @user.description
  end
end

#full_nameObject



11
12
13
14
15
16
17
# File 'lib/rst/user_presenter.rb', line 11

def full_name
  if @user.full_name == ""
    "No full name"
  else
    @user.full_name
  end
end

#to_sObject



7
8
9
# File 'lib/rst/user_presenter.rb', line 7

def to_s
  "#{@user.username} (#{full_name}): #{description}"
end