Screen Too Small

This course material requires a larger screen to properly display the terminal and editor interfaces.

Please use a tablet, laptop, or desktop computer for the best learning experience.

You can continue browsing, but the experience will be significantly limited.

Vim Dojo challenge #24

Fix the New Hire’s JavaScript‑y Methods

We just hired a new developer coming from JavaScript. Even though they see that method names are underscored in Ruby, they can’t shake their camelCase habit. Let’s clean up the file and make it idiomatic Ruby!

challenge.txt :set list

Start

 1class UserService
 2  def getUserData()
 3    # fetch user data
 4  end
 5
 6  def sendEmailToClient()
 7    # email logic
 8  end
 9
10  def logErrorMessage()
11    # logging
12  end
13
14  def handlePaymentUpdate()
15    # payments
16  end
17
18  def fetchOrderHistory()
19    # order history
20  end
21
22  def setUserRole(role)
23    # set the user role
24  end
25end

Goal

 1class UserService
 2  def get_user_data
 3    # fetch user data
 4  end
 5
 6  def send_email_to_client
 7    # email logic
 8  end
 9
10  def log_error_message
11    # logging
12  end
13
14  def handle_payment_update
15    # payments
16  end
17
18  def fetch_order_history
19    # order history
20  end
21
22  def set_user_role(role)
23    # set the user role
24  end
25end

Members only

Hold on, cowboy

You gotta sign in to take on challenges. New ones drop every week — they're fun, and insightful.