Weird array output


#1
#CLASSES---------------------------------------
class List
	attr_reader :tasks
	def initialize
		@tasks = []
	end

	def add_task(task)
		@tasks << task
	end
	def show
	 @tasks	
	end
end

class Task
	attr_reader :description
	def initialize(description)
      @description = description
    end
end

#ACTIONS-----------------------------------------
if __FILE__ == $PROGRAM_NAME
  my_list = List.new
  puts 'You have created a new list'
  my_list.add_task(Task.new("Lernen"))
  puts "New task created"
  puts my_list.show
end 

So this is my code. It all works fine and I’m making progress, but every time i execute it the puts my_list.show I get an really weird output. #<Task:0x007ffaf5041030>
I just don’t get it.
(By the way, totally new to programming. So the code probably looks really bad ^^)


#2

I tried around a bit more and came to the conclusion that, its not the array it self. It’s the task object. But i cant figure out what the problem is…


#3

Good job figuring this out today!

class Task
attr_reader :description
def initialize(description)
@description = description
end

def to_s
description
end
end