Class: UserPrinter
- Inherits:
-
Object
- Object
- UserPrinter
- Defined in:
- lib/ft_42.rb
Instance Attribute Summary collapse
-
#pastel ⇒ Object
readonly
Returns the value of attribute pastel.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #all ⇒ Object
- #contact ⇒ Object
- #correction_points ⇒ Object
- #current_projects ⇒ Object
-
#initialize(user) ⇒ UserPrinter
constructor
A new instance of UserPrinter.
- #level ⇒ Object
- #name ⇒ Object
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
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel.
412 413 414 |
# File 'lib/ft_42.rb', line 412 def pastel @pastel end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
412 413 414 |
# File 'lib/ft_42.rb', line 412 def user @user end |
Instance Method Details
#all ⇒ Object
419 420 421 422 423 424 |
# File 'lib/ft_42.rb', line 419 def all name current_projects level correction_points end |
#contact ⇒ Object
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_points ⇒ Object
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_projects ⇒ Object
430 431 432 |
# File 'lib/ft_42.rb', line 430 def current_projects puts "Is working on #{highlight(user.current_projects.to_sentence)}." end |
#level ⇒ Object
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 |
#name ⇒ Object
426 427 428 |
# File 'lib/ft_42.rb', line 426 def name puts highlight(user.full_name) end |