Class: UserPrinter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ UserPrinter

Returns a new instance of UserPrinter.



194
195
196
197
# File 'lib/ft_42.rb', line 194

def initialize(user)
  @pastel = Pastel.new
  @user = user
end

Instance Attribute Details

#pastelObject (readonly)

Returns the value of attribute pastel.



192
193
194
# File 'lib/ft_42.rb', line 192

def pastel
  @pastel
end

#userObject (readonly)

Returns the value of attribute user.



192
193
194
# File 'lib/ft_42.rb', line 192

def user
  @user
end

Instance Method Details

#allObject



199
200
201
202
203
204
# File 'lib/ft_42.rb', line 199

def all
  name
  current_projects
  level
  correction_points
end

#contactObject



224
225
226
# File 'lib/ft_42.rb', line 224

def contact
  puts "You can contact #{user.first_name.titleize} at #{highlight(ActiveSupport::NumberHelper.number_to_phone(user.phone))}."
end

#correction_pointsObject



218
219
220
221
222
# File 'lib/ft_42.rb', line 218

def correction_points
  print "Has #{highlight(ActionView::Base.new.pluralize(user.correction_points, 'correction point'))}."
  grabs_pitchfork if user.correction_points > 6
  puts
end

#current_projectsObject



210
211
212
# File 'lib/ft_42.rb', line 210

def current_projects
  puts "Is working on #{highlight(user.current_projects.to_sentence)}."
end

#levelObject



214
215
216
# File 'lib/ft_42.rb', line 214

def level
  puts "Is level #{highlight(ActiveSupport::NumberHelper.number_to_rounded(user.level, precision: 2))}"
end

#nameObject



206
207
208
# File 'lib/ft_42.rb', line 206

def name
  puts highlight(user.full_name)
end