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.
196 197 198 199 |
# File 'lib/ft_42.rb', line 196 def initialize(user) @pastel = Pastel.new @user = user end |
Instance Attribute Details
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel.
194 195 196 |
# File 'lib/ft_42.rb', line 194 def pastel @pastel end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
194 195 196 |
# File 'lib/ft_42.rb', line 194 def user @user end |
Instance Method Details
#all ⇒ Object
201 202 203 204 205 206 |
# File 'lib/ft_42.rb', line 201 def all name current_projects level correction_points end |
#contact ⇒ Object
226 227 228 |
# File 'lib/ft_42.rb', line 226 def contact puts "You can contact #{user.first_name.titleize} at #{highlight(ActiveSupport::NumberHelper.number_to_phone(user.phone))}." end |
#correction_points ⇒ Object
220 221 222 223 224 |
# File 'lib/ft_42.rb', line 220 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
212 213 214 |
# File 'lib/ft_42.rb', line 212 def current_projects puts "Is working on #{highlight(user.current_projects.to_sentence)}." end |
#level ⇒ Object
216 217 218 |
# File 'lib/ft_42.rb', line 216 def level puts "Is level #{highlight(ActiveSupport::NumberHelper.number_to_rounded(user.level, precision: 2))}" end |
#name ⇒ Object
208 209 210 |
# File 'lib/ft_42.rb', line 208 def name puts highlight(user.full_name) end |