I really tried to investigate this problem, but now I am so close to it that I canβt find a solution without asking for help. I walk through RubyMonk, and one of the exercises completely surpassed me.
class Hero def initialize(*names) @names = names end def full_name # a hero class allows us to easily combine an arbitrary number of names end end def names heroes = [Hero.new("Christopher", "Alexander"), Hero.new("John", "McCarthy"), Hero.new("Emperor", "Joshua", "Abraham", "Norton")] # map over heroes using your new powers! end
In the comments that the code asks for, you can see; take the names in the variable of the heroes and combine them into one name. I tried to test some puts and I canβt get anything in STDOUT except β#β or βnilβ, so I donβt work with it clearly.
Requirements for the goal say not to use .map or .collect, but I think that you really should, because it does not work out the requirement if you do not use .map or .collect.
Ideas?
source share