Vim Dojo challenge
Your kid is learning Ruby and made a great start — now help them level up! Refactor this seasonal chore class so it calls real methods and reads cleanly.
Start
class Chore def initialize(stuff) @stuff = stuff end def do_all for thing in @stuff do puts thing end end def rake_leaves puts "Raking leaves..." end def make_pumpkin_spice_latte puts "Brewing pumpkin spice latte..." end end
Goal
class Chore def initialize(chores) @chores = chores end def do_all for chore in @chores do send(chore) end end def rake_leaves puts "Raking leaves..." end def make_pumpkin_spice_latte puts "Brewing pumpkin spice latte..." end end
Members only
You gotta sign in to take on challenges. New ones drop every week — they're fun, and insightful.