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.



414
415
416
417
# File 'lib/ft_42.rb', line 414

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

Instance Attribute Details

#pastelObject (readonly)

Returns the value of attribute pastel.



412
413
414
# File 'lib/ft_42.rb', line 412

def pastel
  @pastel
end

#userObject (readonly)

Returns the value of attribute user.



412
413
414
# File 'lib/ft_42.rb', line 412

def user
  @user
end

Instance Method Details

#allObject



419
420
421
422
423
424
# File 'lib/ft_42.rb', line 419

def all
  name
  current_projects
  level
  correction_points
end

#contactObject



444
445
446
# File 'lib/ft_42.rb', line 444

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

#correction_pointsObject



438
439
440
441
442
# File 'lib/ft_42.rb', line 438

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

#current_projectsObject



430
431
432
# File 'lib/ft_42.rb', line 430

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

#levelObject



434
435
436
# File 'lib/ft_42.rb', line 434

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

#nameObject



426
427
428
# File 'lib/ft_42.rb', line 426

def name
  puts highlight(user.full_name)
end