Karla Lara

Joined

20 Experience
0 Lessons Completed
0 Questions Solved

Activity

Learn Hotwire uses a separate login from GoRails. Try the “Forgot your password?” on their site to reset your account. If that doesn’t work, contact their support for help. GoRails credentials won’t work there.

You can include Enumerable in your class, but you’ll need to define an each method (yielding your elements). Then you’ll get all the Enumerable methods like map, select, etc., for free. For example:
class MyCollection
include Enumerable

def initialize(items)
@items = items
end

def each(&block)
@items.each(&block)
end
end
With that in place, MyCollection.new([1,2,3]).map { |i| i * 2 } works perfectly. Hope that helps!